Exemplo n.º 1
0
 public function match(View $view)
 {
     if (!$view instanceof BlockValueView) {
         return false;
     }
     return isset($this->values[$view->getBlock()->id]);
 }
Exemplo n.º 2
0
 /**
  * Returns a ContentView object corresponding to block found within $view, or null if not applicable.
  *
  * @param \eZ\Publish\Core\MVC\Symfony\View\View $view
  *
  * @return \eZ\Publish\Core\MVC\Symfony\View\ContentView
  */
 public function getView(View $view)
 {
     if (!$view instanceof BlockView) {
         return null;
     }
     $block = $view->getBlock();
     $legacyKernel = $this->getLegacyKernel();
     $legacyBlockClosure = function (array $params) use($block, $legacyKernel) {
         return $legacyKernel->runCallback(function () use($block, $params) {
             $tpl = eZTemplate::factory();
             /**
              * @var \eZObjectForwarder
              */
             $funcObject = $tpl->fetchFunctionObject('block_view_gui');
             if (!$funcObject) {
                 return '';
             }
             $children = array();
             $funcObject->process($tpl, $children, 'block_view_gui', false, array('block' => array(array(eZTemplate::TYPE_ARRAY, new BlockAdapter($block)))), array(), '', '');
             if (is_array($children) && isset($children[0])) {
                 return ezpEvent::getInstance()->filter('response/output', $children[0]);
             }
             return '';
         }, false);
     };
     return new ContentView($legacyBlockClosure);
 }