You are here

interface MenuParentFormSelectorInterface in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Menu/MenuParentFormSelectorInterface.php \Drupal\Core\Menu\MenuParentFormSelectorInterface
  2. 9 core/lib/Drupal/Core/Menu/MenuParentFormSelectorInterface.php \Drupal\Core\Menu\MenuParentFormSelectorInterface

Defines an interface for menu selector form elements and menu link options.

Hierarchy

Expanded class hierarchy of MenuParentFormSelectorInterface

All classes that implement MenuParentFormSelectorInterface

7 files declare their use of MenuParentFormSelectorInterface
MenuController.php in core/modules/menu_ui/src/Controller/MenuController.php
MenuLinkContentForm.php in core/modules/menu_link_content/src/Form/MenuLinkContentForm.php
MenuLinkDefaultForm.php in core/lib/Drupal/Core/Menu/Form/MenuLinkDefaultForm.php
MenuLinkDefaultFormTest.php in core/tests/Drupal/Tests/Core/Menu/MenuLinkDefaultFormTest.php
Node.php in core/modules/node/src/Plugin/views/wizard/Node.php

... See full list

File

core/lib/Drupal/Core/Menu/MenuParentFormSelectorInterface.php, line 10

Namespace

Drupal\Core\Menu
View source
interface MenuParentFormSelectorInterface {

  /**
   * Gets the options for a select element to choose a menu and parent.
   *
   * @param string $id
   *   Optional ID of a link plugin. This will exclude the link and its
   *   children from the select options.
   * @param array $menus
   *   Optional array of menu names as keys and titles as values to limit
   *   the select options.  If NULL, all menus will be included.
   * @param \Drupal\Core\Cache\CacheableMetadata|null &$cacheability
   *   Optional cacheability metadata object, which will be populated based on
   *   the accessibility of the links and the cacheability of the links.
   *
   * @return array
   *   Keyed array where the keys are contain a menu name and parent ID and
   *   the values are a menu name or link title indented by depth.
   */
  public function getParentSelectOptions($id = '', array $menus = NULL, CacheableMetadata &$cacheability = NULL);

  /**
   * 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.
   *
   * @param string $menu_parent
   *   A menu name and parent ID concatenated with a ':' character to use as the
   *   default value.
   * @param string $id
   *   (optional) ID of a link plugin. This will exclude the link and its
   *   children from being selected.
   * @param 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 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.
   */
  public function parentSelectElement($menu_parent, $id = '', array $menus = NULL);

}

Members