public function EntityReferenceRenderedBase::__construct in Entityreference Rendered Widget 8
Constructs a WidgetBase object.
Parameters
string $plugin_id: The plugin_id for the widget.
mixed $plugin_definition: The plugin implementation definition.
\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The definition of the field to which the widget is associated.
array $settings: The widget settings.
array $third_party_settings: Any third party settings.
Overrides OptionsWidgetBase::__construct
File
- src/
Plugin/ Field/ FieldWidget/ EntityReferenceRenderedBase.php, line 63
Class
- EntityReferenceRenderedBase
- Base class for widgets provided by this module.
Namespace
Drupal\entityreference_rendered_widget\Plugin\Field\FieldWidgetCode
public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings, EntityDisplayRepositoryInterface $entityDisplayRepository, EntityTypeManagerInterface $entityTypeManager) {
parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $third_party_settings);
$this->entityDisplayRepository = $entityDisplayRepository;
$this->entityTypeManager = $entityTypeManager;
$this->fieldSettings = $this
->getFieldSettings();
$this->targetEntityType = $this
->getFieldSetting('target_type');
$this->displayModes = $this->entityDisplayRepository
->getViewModes($this->targetEntityType);
$this->displayModes['default'] = [
'label' => 'Default',
];
$this->labelOptions = [
'before' => $this
->t('Before rendered element'),
'after' => $this
->t('After rendered element'),
'hidden' => $this
->t('Hidden'),
];
}