interface TopBarItemPluginInterface

Interface for top bar plugins.

Hierarchy

Expanded class hierarchy of TopBarItemPluginInterface

All classes that implement TopBarItemPluginInterface

File

core/modules/navigation/src/TopBarItemPluginInterface.php, line 10

Namespace

Drupal\navigation
View source
interface TopBarItemPluginInterface {
  
  /**
   * Returns the translated plugin label.
   *
   * @return string|\Stringable
   *   The translated plugin label.
   */
  public function label() : string|\Stringable;
  
  /**
   * Returns the plugin region.
   *
   * @return \Drupal\navigation\TopBarRegion
   *   The plugin region.
   */
  public function region() : TopBarRegion;
  
  /**
   * Builds and returns the renderable array for this top bar item plugin.
   *
   * If a top bar item should not be rendered because it has no content, then
   * this method must also ensure to return no content: it must then only return
   * an empty array, or an empty array with #cache set (with cacheability
   * metadata indicating the circumstances for it being empty).
   *
   * @return array
   *   A renderable array representing the content of the top bar item.
   */
  public function build();

}

Members

Title Sort descending Modifiers Object type Summary Overrides
TopBarItemPluginInterface::build public function Builds and returns the renderable array for this top bar item plugin. 1
TopBarItemPluginInterface::label public function Returns the translated plugin label. 1
TopBarItemPluginInterface::region public function Returns the plugin region. 1

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.