concrete/src/Block/BlockController.php
protected function load()
    {
        if ($this->btTable) {
            if ($this->btCacheBlockRecord && $this->btCachedBlockRecord && Config::get('concrete.cache.blocks')) {
                $this->record = unserialize(base64_decode($this->btCachedBlockRecord));
            } else {
                $this->record = new BlockRecord($this->btTable);
                $this->record->bID = $this->bID;
                $this->record->Load('bID=' . $this->bID);
                if ($this->btCacheBlockRecord && Config::get('concrete.cache.blocks')) {
                    // this is the first time we're loading
                    $record = base64_encode(serialize($this->record));
                    $db = Database::connection();
                    $db->Execute('update Blocks set btCachedBlockRecord = ? where bID = ?', [$record, $this->bID]);
                }
            }
        }

        $event = new \Symfony\Component\EventDispatcher\GenericEvent();
        $event->setArgument('record', $this->record);
        $event->setArgument('btHandle', $this->btHandle);
        $event->setArgument('bID', $this->bID);
        $ret = Events::dispatch('on_block_load', $event);
        $this->record = $ret->getArgument('record');

        if (is_object($this->record)) {
            foreach ($this->record as $key => $value) {
                $this->{$key} = $value;
                $this->set($key, $value);
            }
        }
    }
protected function load()
    {
        if ($this->btTable) {
            if ($this->btCacheBlockRecord && $this->btCachedBlockRecord && Config::get('concrete.cache.blocks')) {
                $this->record = unserialize(base64_decode($this->btCachedBlockRecord));
            } else {
                $this->record = new BlockRecord($this->btTable);
                $this->record->bID = $this->bID;
                $this->record->Load('bID=' . $this->bID);
                if ($this->btCacheBlockRecord && Config::get('concrete.cache.blocks')) {
                    // this is the first time we're loading
                    $record = base64_encode(serialize($this->record));
                    $db = Database::connection();
                    $db->Execute('update Blocks set btCachedBlockRecord = ? where bID = ?', [$record, $this->bID]);
                }
            }
        }

        $event = new \Symfony\Component\EventDispatcher\GenericEvent();
        $event->setArgument('record', $this->record);
        $event->setArgument('btHandle', $this->btHandle);
        $event->setArgument('bID', $this->bID);
        $ret = Events::dispatch('on_block_load', $event);
        $this->record = $ret->getArgument('record');

        if (is_object($this->record)) {
            foreach ($this->record as $key => $value) {
                $this->{$key} = $value;
                $this->set($key, $value);
            }
        }
    }
protected function load ( ) { if ( $ this -> btTable ) { if ( $ this -> btCacheBlockRecord && $ this -> btCachedBlockRecord && Config :: get ( 'concrete.cache.blocks' ) ) { $ this -> record = unserialize ( base64_decode ( $ this -> btCachedBlockRecord ) ) ; } else { $ this -> record = new BlockRecord ( $ this -> btTable ) ; $ this -> record -> bID = $ this -> bID ; $ this -> record -> Load ( 'bID=' . $ this -> bID ) ; if ( $ this -> btCacheBlockRecord && Config :: get ( 'concrete.cache.blocks' ) ) { // this is the first time we're loading $ record = base64_encode ( serialize ( $ this -> record ) ) ; $ db = Database :: connection ( ) ; $ db -> Execute ( 'update Blocks set btCachedBlockRecord = ? where bID = ?' , [ $ record , $ this -> bID ] ) ; } } } $ event = new \ Symfony \ Component \ EventDispatcher \ GenericEvent ( ) ; $ event -> setArgument ( 'record' , $ this -> record ) ; $ event -> setArgument ( 'btHandle' , $ this -> btHandle ) ; $ event -> setArgument ( 'bID' , $ this -> bID ) ; $ ret = Events :: dispatch ( 'on_block_load' , $ event ) ; $ this -> record = $ ret -> getArgument ( 'record' ) ; if ( is_object ( $ this -> record ) ) { foreach ( $ this -> record as $ key => $ value ) { $ this -> { $ key } = $ value ; $ this -> set ( $ key , $ value ) ; } } }
Loads the BlockRecord class based on its attribute names.
Loads the BlockRecord class based on its attribute names .