You are here

public function Block::label in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/block/src/Entity/Block.php \Drupal\block\Entity\Block::label()
  2. 9 core/modules/block/src/Entity/Block.php \Drupal\block\Entity\Block::label()

Gets the label of the entity.

Return value

string|\Drupal\Core\StringTranslation\TranslatableMarkup|null The label of the entity, or NULL if there is no label defined.

Overrides EntityBase::label

File

core/modules/block/src/Entity/Block.php, line 202

Class

Block
Defines a Block configuration entity class.

Namespace

Drupal\block\Entity

Code

public function label() {
  $settings = $this
    ->get('settings');
  if ($settings['label']) {
    return $settings['label'];
  }
  else {
    $definition = $this
      ->getPlugin()
      ->getPluginDefinition();
    return $definition['admin_label'];
  }
}