本文整理汇总了PHP中Drupal\Component\Plugin\PluginManagerInterface::getDefinitionsForContexts方法的典型用法代码示例。如果您正苦于以下问题:PHP PluginManagerInterface::getDefinitionsForContexts方法的具体用法?PHP PluginManagerInterface::getDefinitionsForContexts怎么用?PHP PluginManagerInterface::getDefinitionsForContexts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Component\Plugin\PluginManagerInterface
的用法示例。
在下文中一共展示了PluginManagerInterface::getDefinitionsForContexts方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: selectSelectionCondition
/**
* Presents a list of selection conditions to add to the page entity.
*
* @param \Drupal\page_manager\PageInterface $page
* The page entity.
* @param string $display_variant_id
* The display variant ID.
*
* @return array
* The selection condition selection page.
*/
public function selectSelectionCondition(PageInterface $page, $display_variant_id)
{
$build = ['#theme' => 'links', '#links' => []];
$available_plugins = $this->conditionManager->getDefinitionsForContexts($page->getContexts());
foreach ($available_plugins as $selection_id => $selection_condition) {
$build['#links'][$selection_id] = ['title' => $selection_condition['label'], 'url' => Url::fromRoute('page_manager.selection_condition_add', ['page' => $page->id(), 'display_variant_id' => $display_variant_id, 'condition_id' => $selection_id]), 'attributes' => ['class' => ['use-ajax'], 'data-dialog-type' => 'modal', 'data-dialog-options' => Json::encode(['width' => 'auto'])]];
}
return $build;
}