You are here

public function BlockPluginTrait::label in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Block/BlockPluginTrait.php \Drupal\Core\Block\BlockPluginTrait::label()
  2. 9 core/lib/Drupal/Core/Block/BlockPluginTrait.php \Drupal\Core\Block\BlockPluginTrait::label()

File

core/lib/Drupal/Core/Block/BlockPluginTrait.php, line 50

Class

BlockPluginTrait
Provides the base implementation of a block plugin.

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