You are here

class MenuSelectParentFormSelector in Menu Select 2.0.x

Same name and namespace in other branches
  1. 8 src/MenuSelectParentFormSelector.php \Drupal\menu_select\MenuSelectParentFormSelector

Override the core 'menu.parent_form_selector' service.

Hierarchy

Expanded class hierarchy of MenuSelectParentFormSelector

1 string reference to 'MenuSelectParentFormSelector'
menu_select.services.yml in ./menu_select.services.yml
menu_select.services.yml
1 service uses MenuSelectParentFormSelector
menu_select.parent_form_selector in ./menu_select.services.yml
Drupal\menu_select\MenuSelectParentFormSelector

File

src/MenuSelectParentFormSelector.php, line 10

Namespace

Drupal\menu_select
View 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

Namesort descending Modifiers Type Description Overrides
MenuParentFormSelector::$entityTypeManager protected property The entity type manager service.
MenuParentFormSelector::$menuLinkTree protected property The menu link tree service.
MenuParentFormSelector::getMenuOptions protected function Gets a list of menu names for use as options.
MenuParentFormSelector::getParentDepthLimit protected function Returns the maximum depth of the possible parents of the menu link.
MenuParentFormSelector::getParentSelectOptions public function Gets the options for a select element to choose a menu and parent. Overrides MenuParentFormSelectorInterface::getParentSelectOptions
MenuParentFormSelector::parentSelectOptionsTreeWalk protected function Iterates over all items in the tree to prepare the parents select options.
MenuParentFormSelector::__construct public function Constructs a \Drupal\Core\Menu\MenuParentFormSelector.
MenuSelectParentFormSelector::parentSelectElement public function Gets a form element to choose a menu and parent. Overrides MenuParentFormSelector::parentSelectElement
StringTranslationTrait::$stringTranslation protected property The string translation service. 4
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.