class MenuSelectParentFormSelector in Menu Select 2.0.x
Same name and namespace in other branches
- 8 src/MenuSelectParentFormSelector.php \Drupal\menu_select\MenuSelectParentFormSelector
Override the core 'menu.parent_form_selector' service.
Hierarchy
- class \Drupal\Core\Menu\MenuParentFormSelector implements MenuParentFormSelectorInterface uses StringTranslationTrait
- class \Drupal\menu_select\MenuSelectParentFormSelector
Expanded class hierarchy of MenuSelectParentFormSelector
1 string reference to 'MenuSelectParentFormSelector'
1 service uses MenuSelectParentFormSelector
File
- src/
MenuSelectParentFormSelector.php, line 10
Namespace
Drupal\menu_selectView source
class MenuSelectParentFormSelector extends MenuParentFormSelector {
/**
* {@inheritdoc}
*/
public function parentSelectElement($menu_parent, $id = '', array $menus = NULL) {
// Instead of building out a select list, return the custom menu select tree
// element.
return [
'#type' => 'menu_select_tree',
'#menu_parent' => $menu_parent,
'#menus' => !isset($menus) ? $this
->getMenuOptions($menus) : $menus,
'#max_depth' => $this
->getParentDepthLimit($id),
'#current_link_id' => $id,
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MenuParentFormSelector:: |
protected | property | The entity type manager service. | |
MenuParentFormSelector:: |
protected | property | The menu link tree service. | |
MenuParentFormSelector:: |
protected | function | Gets a list of menu names for use as options. | |
MenuParentFormSelector:: |
protected | function | Returns the maximum depth of the possible parents of the menu link. | |
MenuParentFormSelector:: |
public | function |
Gets the options for a select element to choose a menu and parent. Overrides MenuParentFormSelectorInterface:: |
|
MenuParentFormSelector:: |
protected | function | Iterates over all items in the tree to prepare the parents select options. | |
MenuParentFormSelector:: |
public | function | Constructs a \Drupal\Core\Menu\MenuParentFormSelector. | |
MenuSelectParentFormSelector:: |
public | function |
Gets a form element to choose a menu and parent. Overrides MenuParentFormSelector:: |
|
StringTranslationTrait:: |
protected | property | The string translation service. | 4 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |