public function BlockBase::label

public BlockBase::label()

Returns the user-facing block label.

@todo Provide other specific label-related methods in https://www.drupal.org/node/2025649.

Return value

string The block label.

Overrides BlockPluginInterface::label

File

core/lib/Drupal/Core/Block/BlockBase.php, line 39

Class

BlockBase
Defines a base block implementation that most blocks plugins will extend.

Namespace

Drupal\Core\Block

Code

public function label() {
  if (!empty($this->configuration['label'])) {
    return $this->configuration['label'];
  }

  $definition = $this->getPluginDefinition();
  // Cast the admin label to a string since it is an object.
  // @see \Drupal\Core\StringTranslation\TranslatableMarkup
  return (string) $definition['admin_label'];
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Block!BlockBase.php/function/BlockBase::label/8.1.x