Security update for Core, with self-updated composer
[yaffs-website] / web / core / lib / Drupal / Core / Menu / MenuParentFormSelectorInterface.php
1 <?php
2
3 namespace Drupal\Core\Menu;
4
5 use Drupal\Core\Cache\CacheableMetadata;
6
7 /**
8  * Defines an interface for menu selector form elements and menu link options.
9  */
10 interface MenuParentFormSelectorInterface {
11
12   /**
13    * Gets the options for a select element to choose a menu and parent.
14    *
15    * @param string $id
16    *   Optional ID of a link plugin. This will exclude the link and its
17    *   children from the select options.
18    * @param array $menus
19    *   Optional array of menu names as keys and titles as values to limit
20    *   the select options.  If NULL, all menus will be included.
21    * @param \Drupal\Core\Cache\CacheableMetadata|null &$cacheability
22    *   Optional cacheability metadata object, which will be populated based on
23    *   the accessibility of the links and the cacheability of the links.
24    *
25    * @return array
26    *   Keyed array where the keys are contain a menu name and parent ID and
27    *   the values are a menu name or link title indented by depth.
28    */
29   public function getParentSelectOptions($id = '', array $menus = NULL, CacheableMetadata &$cacheability = NULL);
30
31   /**
32    * Gets a form element to choose a menu and parent.
33    *
34    * The specific type of form element will vary depending on the
35    * implementation, but callers will normally need to set the #title for the
36    * element.
37    *
38    * @param string $menu_parent
39    *   A menu name and parent ID concatenated with a ':' character to use as the
40    *   default value.
41    * @param string $id
42    *   (optional) ID of a link plugin. This will exclude the link and its
43    *   children from being selected.
44    * @param array $menus
45    *   (optional) Array of menu names as keys and titles as values to limit
46    *   the values that may be selected. If NULL, all menus will be included.
47    *
48    * @return array
49    *   A form element to choose a parent, or an empty array if no possible
50    *   parents exist for the given parameters. The resulting form value will be
51    *   a single string containing the chosen menu name and parent ID separated
52    *   by a ':' character.
53    */
54   public function parentSelectElement($menu_parent, $id = '', array $menus = NULL);
55
56 }