Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. TopBarItemPluginInterface.php

interface TopBarItemPluginInterface

Interface for top bar plugins.

Hierarchy

  • interface \Drupal\navigation\TopBarItemPluginInterface

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal