You are here

public function NodeTitle::build in Exclude Node Title 8

File

src/Plugin/DsField/Node/NodeTitle.php, line 66

Class

NodeTitle
Extended NodeTitle Display Suite plugin.

Namespace

Drupal\exclude_node_title\Plugin\DsField\Node

Code

public function build() {
  $config = $this
    ->getConfiguration();
  if ($config['exclude_node_title']) {
    $exclude_manager = \Drupal::service('exclude_node_title.manager');
    if ($exclude_manager
      ->isTitleExcluded($this
      ->entity(), $this
      ->viewMode())) {
      return [
        '#markup' => '',
      ];
    }
  }
  return Field::build();
}