You are here

public function Markup::build in Display Suite 8.4

Same name and namespace in other branches
  1. 8.2 src/Plugin/DsField/Markup.php \Drupal\ds\Plugin\DsField\Markup::build()
  2. 8.3 src/Plugin/DsField/Markup.php \Drupal\ds\Plugin\DsField\Markup::build()

Renders a field.

Return value

array A renderable array representing the content of the field.

Overrides DsFieldBase::build

1 method overrides Markup::build()
CommentUserSignature::build in src/Plugin/DsField/Comment/CommentUserSignature.php
Renders a field.

File

src/Plugin/DsField/Markup.php, line 13

Class

Markup
DS field markup base field.

Namespace

Drupal\ds\Plugin\DsField

Code

public function build() {
  $key = $this
    ->key();
  if (isset($this
    ->entity()->{$key}->value)) {
    $format = $this
      ->format();
    return [
      '#type' => 'processed_text',
      '#text' => $this
        ->entity()->{$key}->value,
      '#format' => $format,
      '#filter_types_to_skip' => [],
      '#langcode' => '',
    ];
  }
  return [];
}