eZ\Publish\Core\MVC\Symfony\View\View::getViewType PHP Method

getViewType() public method

public getViewType ( )
    public function getViewType();

Usage Example

Example #1
0
 /**
  * Returns a ContentView object corresponding to content info found within $view, or void if not applicable.
  *
  * @param \eZ\Publish\Core\MVC\Symfony\View\View $view
  *
  * @return \eZ\Publish\Core\MVC\Symfony\View\ContentView|void
  */
 public function getView(View $view)
 {
     if (!$view instanceof ContentView) {
         return null;
     }
     $viewType = $view->getViewType();
     $contentInfo = $view->getContent()->contentInfo;
     $legacyKernel = $this->getLegacyKernel();
     $legacyContentClosure = function (array $params) use($contentInfo, $viewType, $legacyKernel) {
         return $legacyKernel->runCallback(function () use($contentInfo, $viewType, $params) {
             $tpl = eZTemplate::factory();
             /**
              * @var \eZObjectForwarder
              */
             $funcObject = $tpl->fetchFunctionObject('content_view_gui');
             if (!$funcObject) {
                 return '';
             }
             // Used by XmlText field type
             if (isset($params['objectParameters'])) {
                 if (isset($params['linkParameters']) && $params['linkParameters'] !== null) {
                     $linkParameters = $params['linkParameters'];
                 }
                 $tpl->setVariable('object_parameters', $params['objectParameters'], 'ContentView');
             } elseif (isset($params['embedParams'])) {
                 if (isset($params['embedParams']['link'])) {
                     $linkParameters = $params['embedParams']['link'];
                 }
                 if (isset($params['embedParams']['config'])) {
                     $tpl->setVariable('object_parameters', $params['embedParams']['config'], 'ContentView');
                 }
             }
             // Convert link parameters to Legacy Stack format
             if (isset($linkParameters)) {
                 $tpl->setVariable('link_parameters', $this->legalizeLinkParameters($linkParameters), 'ContentView');
             }
             $children = array();
             $funcObject->process($tpl, $children, 'content_view_gui', false, array('content_object' => array(array(eZTemplate::TYPE_ARRAY, eZContentObject::fetch($contentInfo->id))), 'view' => array(array(eZTemplate::TYPE_STRING, $viewType))), array(), '', '');
             if (is_array($children) && isset($children[0])) {
                 return ezpEvent::getInstance()->filter('response/output', $children[0]);
             }
             return '';
         }, false);
     };
     $this->decorator->setContentView(new ContentView($legacyContentClosure));
     return $this->decorator;
 }
All Usage Examples Of eZ\Publish\Core\MVC\Symfony\View\View::getViewType