You are here

public function BlockPluginTrait::label in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Block/BlockPluginTrait.php \Drupal\Core\Block\BlockPluginTrait::label()
  2. 10 core/lib/Drupal/Core/Block/BlockPluginTrait.php \Drupal\Core\Block\BlockPluginTrait::label()
2 calls to BlockPluginTrait::label()
BlockPluginTrait::buildConfigurationForm in core/lib/Drupal/Core/Block/BlockPluginTrait.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.
BlockPluginTrait::getPreviewFallbackString in core/lib/Drupal/Core/Block/BlockPluginTrait.php

File

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

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