You are here

public function BundleField::build in Display Suite 8.2

Same name and namespace in other branches
  1. 8.4 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.

Overrides DsFieldBase::build

File

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

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->entityTypeManager
    ->getBundleInfo($config['field']['entity_type']);
  $output = $bundles_info[$entity
    ->bundle()]['label'];
  return array(
    '#markup' => $output,
  );
}