public function match(View $view)
 {
     if (!$view instanceof ContentValueView) {
         return false;
     }
     return $this->matchContentTypeId($view->getContent()->contentInfo->contentTypeId);
 }
Example #2
0
 public function match(View $view)
 {
     if (!$view instanceof ContentView) {
         return false;
     }
     return isset($this->values[$view->getContent()->contentInfo->remoteId]);
 }
Example #3
0
 public function match(View $view)
 {
     if (!$view instanceof ContentValueView) {
         return false;
     }
     $contentType = $this->repository->getContentTypeService()->loadContentType($view->getContent()->contentInfo->contentTypeId);
     return isset($this->values[$contentType->identifier]);
 }
 public function match(View $view)
 {
     if ($view instanceof LocationValueView) {
         return $this->matchLocation($view->getLocation());
     }
     if ($view instanceof ContentValueView) {
         return $this->matchContentInfo($view->getContent()->contentInfo);
     }
     return false;
 }
Example #5
0
 public function match(View $view)
 {
     if (!$view instanceof ContentView) {
         return false;
     }
     $contentInfo = $view->getContent()->contentInfo;
     $section = $this->repository->sudo(function (Repository $repository) use($contentInfo) {
         return $repository->getSectionService()->loadSection($contentInfo->sectionId);
     });
     return isset($this->values[$section->identifier]);
 }
Example #6
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;
 }
 public function getView(View $view)
 {
     $viewType = $view->getViewType();
     if ($viewType !== 'full') {
         return null;
     }
     if (!$view instanceof ContentValueView) {
         return null;
     }
     if ($view->getContent()->contentInfo->sectionId !== $this->premiumSectionId) {
         return null;
     }
     if ($this->subscriptionChecker->userIsSubscriber($this->repository->getCurrentUser())) {
         return null;
     }
     return new ContentView("eZDemoBundle:{$viewType}:premium_content.html.twig");
 }