public function __construct(Block $block) { $c = $block->getBlockCollectionObject(); $type = $c->getPageTypeObject(); $template = $c->getPageTemplateObject(); $control = $block->getController()->getComposerOutputControlObject(); if (is_object($control)) { $control = FormLayoutSetControl::getByID($control->getPageTypeComposerFormLayoutSetControlID()); $label = $control->getPageTypeComposerFormLayoutSetControlCustomLabel(); if (!$label) { $cc = $control->getPageTypeComposerControlObject(); $label = $cc->getPageTypeComposerControlDisplayName(); } $components = array($type->getPageTypeDisplayName(), $template->getPageTemplateDisplayName(), $block->getAreaHandle(), $label); $this->block = $block; $this->setIdentifier($block->getBlockID()); $this->setDisplayName(implode(' > ', $components)); } }
public function getController() { return parent::getController(); }
public static function get(Block $b) { $o = null; if ($b->overrideBlockTypeCacheSettings()) { $c = $b->getBlockCollectionObject(); $cID = $c->getCollectionID(); $cvID = $c->getVersionID(); $a = $b->getBlockAreaObject(); $arHandle = $a->getAreaHandle(); if ($a->isGlobalArea()) { // then we need to check against the global area name. We currently have the wrong area handle passed in $arHandle = STACKS_AREA_NAME; } $bID = $b->getBlockID(); $db = Database::get(); $r = $db->GetRow('select * from CollectionVersionBlocksCacheSettings where cID = ? and cvID = ? and arHandle = ? and bID = ?', array($cID, $cvID, $arHandle, $bID)); if ($r['bID']) { $o = new static(); $o->btCacheBlockOutput = (bool) $r['btCacheBlockOutput']; $o->btCacheBlockOutputOnPost = (bool) $r['btCacheBlockOutputOnPost']; $o->btCacheBlockOutputForRegisteredUsers = (bool) $r['btCacheBlockOutputForRegisteredUsers']; $o->btCacheBlockOutputLifetime = $r['btCacheBlockOutputLifetime']; } } if (!isset($o)) { if ($controller = $b->getController()) { $o = new static(); $o->btCacheBlockOutput = $controller->cacheBlockOutput(); $o->btCacheBlockOutputOnPost = $controller->cacheBlockOutputOnPost(); $o->btCacheBlockOutputForRegisteredUsers = $controller->cacheBlockOutputForRegisteredUsers(); $o->btCacheBlockOutputLifetime = $controller->getBlockTypeCacheOutputLifetime(); } else { $o = new static(); $o->btCacheBlockOutput = false; $o->btCacheBlockOutputOnPost = false; $o->btCacheBlockOutputForRegisteredUsers = false; $o->btCacheBlockOutputLifetime = false; } } return $o; }