public function outputAutoHeaderItems()
 {
     $b = Block::getByID($this->bOriginalID);
     $b = $this->getBlockObject();
     $bvt = new BlockViewTemplate($b);
     $bvt->registerTemplateAssets();
 }
示例#2
0
 public function setupRender()
 {
     parent::setupRender();
     if ($this->block) {
         $obj = $this->block;
     } else {
         $obj = $this->blocktype;
     }
     $bvt = new BlockViewTemplate($obj);
     $bvt->setBlockCustomTemplate('amp.php');
     $this->setViewTemplate($bvt->getTemplate());
     if ($obj->getBlockTypeHandle() == 'youtube') {
         $this->addHeaderAsset('<script async custom-element="amp-youtube" src="https://cdn.ampproject.org/v0/amp-youtube-0.1.js"></script>');
     }
 }
示例#3
0
 public function outputAutoHeaderItems()
 {
     $b = $this->getBlockObject();
     if (is_object($b)) {
         $bvt = new BlockViewTemplate($b);
         $bvt->registerTemplateAssets();
     }
 }
示例#4
0
 public function setupRender()
 {
     $this->runControllerTask();
     $view = $this->viewToRender;
     $env = Environment::get();
     if ($this->viewToRender == 'scrapbook') {
         $scrapbookTemplate = $this->getBlockPath(FILENAME_BLOCK_VIEW_SCRAPBOOK) . '/' . FILENAME_BLOCK_VIEW_SCRAPBOOK;
         if (file_exists($scrapbookTemplate)) {
             $view = 'scrapbook';
         } else {
             $view = 'view';
         }
     }
     $customFilenameToRender = null;
     if (!in_array($this->viewToRender, array('view', 'add', 'edit', 'scrapbook'))) {
         // then we're trying to render a custom view file, which we'll pass to the bottom functions as $_filename
         $customFilenameToRender = $view . '.php';
         $view = 'view';
     }
     switch ($view) {
         case 'view':
             if (is_object($this->block) && is_object($this->area)) {
                 $this->setBlockViewHeaderFile(DIR_FILES_ELEMENTS_CORE . '/block_header_view.php');
                 $this->setBlockViewFooterFile(DIR_FILES_ELEMENTS_CORE . '/block_footer_view.php');
             }
             if ($this->controller->blockViewRenderOverride) {
                 $template = DIRNAME_BLOCKS . '/' . $this->blockType->getBlockTypeHandle() . '/' . $this->controller->blockViewRenderOverride . '.php';
                 $this->setViewTemplate($env->getPath($template, $this->blockTypePkgHandle));
             } else {
                 $bFilename = false;
                 if ($this->block) {
                     $bFilename = $this->block->getBlockFilename();
                     $bvt = new BlockViewTemplate($this->block);
                     if (!$bFilename && is_object($this->area)) {
                         $templates = $this->area->getAreaCustomTemplates();
                         if (isset($templates[$this->block->getBlockTypeHandle()])) {
                             $bFilename = $templates[$this->block->getBlockTypeHandle()];
                         }
                     }
                 } else {
                     $bvt = new BlockViewTemplate($this->blockType);
                 }
                 if ($bFilename) {
                     $bvt->setBlockCustomTemplate($bFilename);
                     // this is PROBABLY already set by the method above, but in the case that it's passed by area we have to set it here
                 } else {
                     if ($customFilenameToRender) {
                         $bvt->setBlockCustomRender($customFilenameToRender);
                     }
                 }
                 $this->setViewTemplate($bvt->getTemplate());
             }
             break;
         case 'add':
             if ($this->controller->blockViewRenderOverride) {
                 $template = DIRNAME_BLOCKS . '/' . $this->blockType->getBlockTypeHandle() . '/' . $this->controller->blockViewRenderOverride . '.php';
             } else {
                 $template = DIRNAME_BLOCKS . '/' . $this->blockType->getBlockTypeHandle() . '/' . FILENAME_BLOCK_ADD;
             }
             $this->setViewTemplate($env->getPath($template, $this->blockTypePkgHandle));
             break;
         case 'scrapbook':
             $this->setViewTemplate($env->getPath(DIRNAME_BLOCKS . '/' . $this->blockType->getBlockTypeHandle() . '/' . FILENAME_BLOCK_VIEW_SCRAPBOOK, $this->blockTypePkgHandle));
             break;
         case 'edit':
             if ($this->controller->blockViewRenderOverride) {
                 $template = DIRNAME_BLOCKS . '/' . $this->blockType->getBlockTypeHandle() . '/' . $this->controller->blockViewRenderOverride . '.php';
             } else {
                 $template = DIRNAME_BLOCKS . '/' . $this->blockType->getBlockTypeHandle() . '/' . FILENAME_BLOCK_EDIT;
             }
             $this->setBlockViewHeaderFile(DIR_FILES_ELEMENTS_CORE . '/block_header_edit.php');
             $this->setBlockViewFooterFile(DIR_FILES_ELEMENTS_CORE . '/block_footer_edit.php');
             $this->setViewTemplate($env->getPath($template, $this->blockTypePkgHandle));
             break;
     }
     $this->viewPerformed = $view;
 }