You are here

public function EntityBlockBlock::label in Entityblock 8

Overrides BlockPluginTrait::label

2 calls to EntityBlockBlock::label()
EntityBlockBlock::build in src/Plugin/Block/EntityBlockBlock.php
Implements \Drupal\block\BlockBase::blockBuild().
EntityBlockBlock::getMachineNameSuggestion in src/Plugin/Block/EntityBlockBlock.php

File

src/Plugin/Block/EntityBlockBlock.php, line 123
Contains \Drupal\entityblock\Plugin\Block\EntityBlockBlock.

Class

EntityBlockBlock
Provides an entityblock block.

Namespace

Drupal\entityblock\Plugin\Block

Code

public function label() {
  $field_value = $this
    ->loadFieldValue();
  if ($field_value && (!isset($this->configuration['label_override']) || !$this->configuration['label_override'])) {
    $title = $field_value->title;
    $entity = $this
      ->loadEntity();
    return \Drupal::token()
      ->replace($title, [
      $entity
        ->getEntityTypeId() => $entity,
    ]);
  }
  return parent::label();
}