public function BundleField::build in Display Suite 8.2
Same name and namespace in other branches
- 8.4 src/Plugin/DsField/BundleField.php \Drupal\ds\Plugin\DsField\BundleField::build()
- 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\DsFieldCode
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,
);
}