public function BatEventHandlerDurationField::render in Booking and Availability Management Tools for Drupal 8
Renders the field.
Parameters
\Drupal\views\ResultRow $values: The values retrieved from a single row of a view's query result.
Return value
string|\Drupal\Component\Render\MarkupInterface The rendered output. If the output is safe it will be wrapped in an object that implements MarkupInterface. If it is empty or unsafe it will be a string.
Overrides FieldPluginBase::render
File
- modules/
bat_event/ src/ Plugin/ views/ field/ BatEventHandlerDurationField.php, line 58
Class
- BatEventHandlerDurationField
- Plugin annotation @ViewsField("bat_event_handler_duration_field");
Namespace
Drupal\bat_event\Plugin\views\fieldCode
public function render(ResultRow $values) {
$event = $this
->getEntity($values);
$value = $event
->getEndDate()
->getTimestamp() - $event
->getStartDate()
->getTimestamp();
return $this
->sanitizeValue($this->dateFormatter
->formatInterval($value));
}