public function GroupContentMenuParentFormSelector::parentSelectElement in Group Content Menu 8
Gets a form element to choose a menu and parent.
The specific type of form element will vary depending on the implementation, but callers will normally need to set the #title for the element.
Parameters
string $menu_parent: A menu name and parent ID concatenated with a ':' character to use as the default value.
string $id: (optional) ID of a link plugin. This will exclude the link and its children from being selected.
array $menus: (optional) Array of menu names as keys and titles as values to limit the values that may be selected. If NULL, all menus will be included.
Return value
array A form element to choose a parent, or an empty array if no possible parents exist for the given parameters. The resulting form value will be a single string containing the chosen menu name and parent ID separated by a ':' character.
Overrides MenuParentFormSelector::parentSelectElement
File
- src/
GroupContentMenuParentFormSelector.php, line 25
Class
- GroupContentMenuParentFormSelector
- Group content menu implementation of the menu parent form selector service.
Namespace
Drupal\group_content_menuCode
public function parentSelectElement($menu_parent, $id = '', array $menus = NULL) {
if (strpos($menu_parent, GroupContentMenuInterface::MENU_PREFIX) !== FALSE) {
$this->isGroupMenu = TRUE;
}
$element = parent::parentSelectElement($menu_parent, $id, $menus);
// Add the group content list tag in case a menu is created, deleted, etc.
$element['#cache']['tags'] = $element['#cache']['tags'] ?? [];
$element['#cache']['tags'] = Cache::mergeTags($element['#cache']['tags'], [
'group_content_list',
]);
return $element;
}