public function DateRecurFieldSimpleRender::getEntity in Recurring Dates Field 8
Gets the entity matching the current row and relationship.
Parameters
\Drupal\views\ResultRow $values: An object containing all retrieved values.
Return value
\Drupal\Core\Entity\EntityInterface|null Returns the entity matching the values or NULL if there is no matching entity.
Overrides FieldPluginBase::getEntity
1 call to DateRecurFieldSimpleRender::getEntity()
- DateRecurFieldSimpleRender::render in src/
Plugin/ views/ field/ DateRecurFieldSimpleRender.php - Renders the field.
File
- src/
Plugin/ views/ field/ DateRecurFieldSimpleRender.php, line 87
Class
- DateRecurFieldSimpleRender
- A handler to provide a field that is completely custom by the administrator.
Namespace
Drupal\date_recur\Plugin\views\fieldCode
public function getEntity(ResultRow $values) {
$entity = parent::getEntity($values);
$field_name = $this->definition['field_name'];
$item = $entity->{$field_name}
->first();
$item->value = $values->{$this->field_alias};
if (!empty($this->aliases[$field_name . '_end_value'])) {
$item->end_value = $values->{$this->aliases[$field_name . '_end_value']};
}
$entity->{$field_name}
->filter(function (DateRecurItem $item) {
if ($item
->getDelta() === 0) {
return TRUE;
}
return FALSE;
});
return $entity;
}