public function EventDateStringField::init in RNG - Events and Registrations 3.x
Same name and namespace in other branches
- 8.2 src/Plugin/views/field/EventDateStringField.php \Drupal\rng\Plugin\views\field\EventDateStringField::init()
Initialize the plugin.
Parameters
\Drupal\views\ViewExecutable $view: The view object.
\Drupal\views\Plugin\views\display\DisplayPluginBase $display: The display handler.
array $options: The options configured for this plugin.
Overrides FieldPluginBase::init
File
- src/
Plugin/ views/ field/ EventDateStringField.php, line 102
Class
- EventDateStringField
- A handler to provide a field that is completely custom by the administrator.
Namespace
Drupal\rng\Plugin\views\fieldCode
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
parent::init($view, $display, $options);
if (empty($options['entity_type'])) {
return;
}
$type = $options['entity_type'];
$bundle = $options['entity_bundle'];
$event = $this->eventManager
->eventType($type, $bundle);
if ($event) {
$field = $event
->getEventStartDateField();
$definitions = $this->entityFieldManager
->getFieldDefinitions($this->configuration['entity_type'], $this->options['entity_bundle']);
$field_def = $definitions[$field];
$table = $type . '__' . $field;
$fieldname = $field . '_value';
$this->realField = $fieldname;
$this->table = $table;
}
}