本文整理汇总了PHP中Drupal\Core\Entity\EntityInterface::getExecutable方法的典型用法代码示例。如果您正苦于以下问题:PHP EntityInterface::getExecutable方法的具体用法?PHP EntityInterface::getExecutable怎么用?PHP EntityInterface::getExecutable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Entity\EntityInterface
的用法示例。
在下文中一共展示了EntityInterface::getExecutable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
/**
* {@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;
}
示例2: getDisplayPaths
/**
* 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);
}
示例3: getDisplayPaths
/**
* 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);
}