public function PageManagerController::selectSelectionCondition in Page Manager 8
Same name and namespace in other branches
- 8.4 page_manager_ui/src/Controller/PageManagerController.php \Drupal\page_manager_ui\Controller\PageManagerController::selectSelectionCondition()
Presents a list of selection conditions to add to the page entity.
Parameters
\Drupal\page_manager\PageVariantInterface $page_variant: The page variant entity.
Return value
array The selection condition selection page.
File
- page_manager_ui/
src/ Controller/ PageManagerController.php, line 274 - Contains \Drupal\page_manager_ui\Controller\PageManagerController.
Class
- PageManagerController
- Provides route controllers for Page Manager.
Namespace
Drupal\page_manager_ui\ControllerCode
public function selectSelectionCondition(PageVariantInterface $page_variant) {
$build = [
'#theme' => 'links',
'#links' => [],
];
$available_plugins = $this->conditionManager
->getDefinitionsForContexts($page_variant
->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_variant
->get('page'),
'page_variant' => $page_variant
->id(),
'condition_id' => $selection_id,
]),
'attributes' => $this
->getAjaxAttributes(),
];
}
return $build;
}