public function NodeTitle::__construct in Display Suite 8.3
Same name and namespace in other branches
- 8.4 src/Plugin/DsField/Node/NodeTitle.php \Drupal\ds\Plugin\DsField\Node\NodeTitle::__construct()
- 8.2 src/Plugin/DsField/Node/NodeTitle.php \Drupal\ds\Plugin\DsField\Node\NodeTitle::__construct()
Constructs a Display Suite field plugin.
Overrides DsFieldBase::__construct
File
- src/
Plugin/ DsField/ Node/ NodeTitle.php, line 22
Class
- NodeTitle
- Plugin that renders the title of a node.
Namespace
Drupal\ds\Plugin\DsField\NodeCode
public function __construct($configuration, $plugin_id, $plugin_definition) {
// Set the title, used to construct the field label, based on the label
// of the node type's title field.
if (!empty($configuration['entity'])) {
/* @var \Drupal\Core\Field\FieldDefinitionInterface $field */
$field = $configuration['entity']
->getFieldDefinition('title');
$title = $field
->getLabel();
$configuration['field']['title'] = $title;
$plugin_definition['title'] = $title;
}
parent::__construct($configuration, $plugin_id, $plugin_definition);
}