You are here

public function BlockBase::label in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Block/BlockBase.php \Drupal\Core\Block\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

1 call to BlockBase::label()
BlockBase::buildConfigurationForm in core/lib/Drupal/Core/Block/BlockBase.php
Creates a generic configuration form for all block types. Individual block plugins can add elements to this form by overriding BlockBase::blockForm(). Most block plugins should not override this method unless they need to alter the generic form elements.

File

core/lib/Drupal/Core/Block/BlockBase.php, line 44
Contains \Drupal\Core\Block\BlockBase.

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'];
}