You are here

public function BundleField::build in Display Suite 8.4

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

Renders a field.

Return value

array A renderable array representing the content of the field.

Overrides DsFieldBase::build

File

src/Plugin/DsField/BundleField.php, line 53

Class

BundleField
Defines a generic bundle field.

Namespace

Drupal\ds\Plugin\DsField

Code

public function build() {
  $config = $this
    ->getConfiguration();
  $entity = $this
    ->entity();
  $bundles_info = $this->entityTypeBundleInfo
    ->getBundleInfo($config['field']['entity_type']);
  $output = $bundles_info[$entity
    ->bundle()]['label'];
  return [
    '#markup' => $output,
  ];
}