StaticMenuLinkOverridesInterface.php 2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
<?php

/**
 * @file
 * Contains \Drupal\Core\Menu\StaticMenuLinkOverridesInterface.
 */

namespace Drupal\Core\Menu;

/**
 * Defines an interface for objects which overrides menu links defined in YAML.
 */
interface StaticMenuLinkOverridesInterface {

  /**
   * Reloads the overrides from config.
   *
   * Forces all overrides to be reloaded from config storage to compare the
   * override value with the value submitted during test form submission.
   */
  public function reload();

  /**
   * Loads any overrides to the definition of a static (YAML-defined) link.
   *
   * @param string $id
   *   A menu link plugin ID.
   *
   * @return array|NULL
   *   An override with following supported keys:
   *     - parent
   *     - weight
   *     - menu_name
   *     - expanded
35
   *     - enabled
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
   *   or NULL if there is no override for the given ID.
   */
  public function loadOverride($id);

  /**
   * Deletes any overrides to the definition of a static (YAML-defined) link.
   *
   * @param string $id
   *   A menu link plugin ID.
   */
  public function deleteOverride($id);

  /**
   * Deletes multiple overrides to definitions of static (YAML-defined) links.
   *
   * @param array $ids
   *   Array of menu link plugin IDs.
   */
  public function deleteMultipleOverrides(array $ids);

  /**
   * Loads overrides to multiple definitions of a static (YAML-defined) link.
   *
   * @param array $ids
   *   Array of menu link plugin IDs.
   *
   * @return array
   *   One or override keys by plugin ID.
   *
   * @see \Drupal\Core\Menu\StaticMenuLinkOverridesInterface
   */
  public function loadMultipleOverrides(array $ids);

  /**
   * Saves the override.
   *
   * @param string $id
   *   A menu link plugin ID.
   * @param array $definition
   *   The definition values to override. Supported keys:
   *   - menu_name
   *   - parent
   *   - weight
   *   - expanded
80
   *   - enabled
81 82 83 84 85 86 87
   *
   * @return array
   *   A list of properties which got saved.
   */
  public function saveOverride($id, array $definition);

}