eZ\Publish\Core\MVC\Symfony\View\ContentView::setLocation PHP Method

setLocation() public method

public setLocation ( eZ\Publish\API\Repository\Values\Content\Location $location )
$location eZ\Publish\API\Repository\Values\Content\Location
    public function setLocation(Location $location)
    {
        $this->location = $location;
    }

Usage Example

 /**
  * Tests if $location has match a view that uses a custom controller.
  *
  * @since 5.4.5
  *
  * @param $content Content
  * @param $location Location
  * @param $viewMode string
  *
  * @return bool
  */
 public function usesCustomController(Content $content, Location $location, $viewMode = 'full')
 {
     $contentView = new ContentView(null, [], $viewMode);
     $contentView->setContent($content);
     $contentView->setLocation($location);
     foreach ($this->viewProviders as $viewProvider) {
         $view = $viewProvider->getView($contentView);
         if ($view instanceof View) {
             if ($view->getControllerReference() !== null) {
                 return true;
             }
         }
     }
     return false;
 }
All Usage Examples Of eZ\Publish\Core\MVC\Symfony\View\ContentView::setLocation