/** * If post view, setup the post with child blocks * * @return $this */ protected function _beforeToHtml() { if ($this->getPost() && $this->_getBlockForPostPrepare() !== false) { $this->preparePost($this->getPost()); } return parent::_beforeToHtml(); }
/** * Setup the comments block * */ protected function _beforeToHtml() { if (($commentsBlock = $this->getChild('comments')) !== false) { $commentsBlock->setPost($this->getPage()); } return parent::_beforeToHtml(); }
/** * Load all enabled widgets * * @return Fishpig_Wordpress_Block_Sidebar */ protected function _beforeToHtml() { if (isset(self::$_lockedWidgetAreas[$this->getWidgetArea()])) { return $this; } self::$_lockedWidgetAreas[$this->getWidgetArea()] = true; if ($widgets = $this->getWidgetsArray()) { $this->_initAvailableWidgets(); foreach ($widgets as $widgetType) { $name = $this->_getWidgetName($widgetType); $widgetIndex = $this->_getWidgetIndex($widgetType); if ($widget = $this->getWidgetType($name)) { if ($block = $this->getLayout()->createBlock($widget['block'])) { if (isset($widget['template']) && !empty($widget['template'])) { $block->setTemplate($widget['template']); } $block->setWidgetType($name); $block->setWidgetIndex($widgetIndex); $this->setChild('wordpress_widget_' . $widgetType, $block); } } } } if (!$this->getTemplate()) { $this->setTemplate('wordpress/sidebar.phtml'); } return parent::_beforeToHtml(); }
/** * Attempt to load the widget information from the WordPress options table * * @return Fishpig_Wordpress_Block_Sidebar_Widget_Abstract */ protected function _beforeToHtml() { if ($this->getWidgetType()) { $data = $this->helper('wordpress')->getWpOption('widget_' . $this->getWidgetType()); if ($data) { $data = unserialize($data); if (isset($data[$this->getWidgetIndex()])) { foreach ($data[$this->getWidgetIndex()] as $field => $value) { if ($this->_fixOptionKeys) { $field = preg_replace('/([A-Z]{1})([A-Z]{1,})/e', "'\$1' . strtolower('\$2');", $field); $field = preg_replace('/([A-Z]{1})/e', "'_' . strtolower('\$1');", $field); } $this->setData($field, $value); } } } } return parent::_beforeToHtml(); }
/** * This block is deprecated and will no longer work * * @return $this */ protected function _beforeToHtml() { $this->setTemplate(null); return parent::_beforeToHtml(); }