function BlockPluginTrait::label

Same name in other branches
  1. 8.9.x 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()
  3. 11.x 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 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'];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.