/** * {@inheritdoc} */ public function view(EntityInterface $entity, $view_mode = 'full', $langcode = NULL) { $build = []; /** @var $entity \Drupal\page_manager\PageInterface */ if ($display_variant = $entity->getExecutable()->selectDisplayVariant()) { $build = $display_variant->build(); } return $build; }
/** * Gets a list of paths assigned to the view. * * @param \Drupal\Core\Entity\EntityInterface $view * The view entity. * * @return array * An array of paths for this view. */ protected function getDisplayPaths(EntityInterface $view) { $all_paths = array(); $executable = $view->getExecutable(); $executable->initDisplay(); foreach ($executable->displayHandlers as $display) { if ($display->hasPath()) { $path = $display->getPath(); if ($view->status() && strpos($path, '%') === FALSE) { // @todo Views should expect and store a leading /. See: // https://www.drupal.org/node/2423913 $all_paths[] = \Drupal::l('/' . $path, Url::fromUserInput('/' . $path)); } else { $all_paths[] = '/' . $path; } } } return array_unique($all_paths); }
/** * Gets a list of paths assigned to the view. * * @param \Drupal\Core\Entity\EntityInterface $view * The view entity. * * @return array * An array of paths for this view. */ protected function getDisplayPaths(EntityInterface $view) { $all_paths = array(); $executable = $view->getExecutable(); $executable->initDisplay(); foreach ($executable->displayHandlers as $display) { if ($display->hasPath()) { $path = $display->getPath(); if ($view->status() && strpos($path, '%') === FALSE) { $all_paths[] = _l('/' . $path, $path); } else { $all_paths[] = String::checkPlain('/' . $path); } } } return array_unique($all_paths); }