/** * Return Viewer object * * @return \XLite\View\Controller */ public function getViewer() { $viewer = parent::getViewer(); if ($this->isAJAXViewer() && \XLite\Core\Request::getInstance()->widgetConfId && \XLite\Module\CDev\DrupalConnector\Handler::isCMSStarted()) { $data = \XLite\Module\CDev\DrupalConnector\Drupal\Model::getInstance()->getBlock(\XLite\Core\Request::getInstance()->widgetConfId); if ($data && isset($data['options']) && is_array($data['options'])) { $viewer->setWidgetParams($data['options']); } } return $viewer; }
/** * Get block content from LC (if needed) * * @param array &$data An array of data, as returned from the hook_block_view() * @param \stdClass $block The block object, as loaded from the database * * @return boolean */ public function setBlockContent(array &$data, \stdClass $block) { // Check if current block is an LC one $blockInfo = \XLite\Module\CDev\DrupalConnector\Drupal\Model::getInstance()->getBlock($block->delta); if ('block' == $block->module && $blockInfo) { // Trying to get widget from LC $widget = $this->getHandler()->getWidget($blockInfo['lc_class'], $blockInfo['options']); if ($widget) { // Check if widget is visible and its content is not empty $data['content'] = $widget->checkVisibility() && ($content = $widget->getContent()) ? $content : null; } } return true; }
/** * Return block description * * @param integer $delta Block ID * * @return array */ protected function getBlock($delta) { return \XLite\Module\CDev\DrupalConnector\Drupal\Model::getInstance()->getBlock($delta); }