public function MaestroEngineStartedTimestamp::render in Maestro 8.2
Same name and namespace in other branches
- 3.x src/Plugin/views/field/MaestroEngineStartedTimestamp.php \Drupal\maestro\Plugin\views\field\MaestroEngineStartedTimestamp::render()
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
- src/
Plugin/ views/ field/ MaestroEngineStartedTimestamp.php, line 62
Class
- MaestroEngineStartedTimestamp
- Field handler to generate started timestamp.
Namespace
Drupal\maestro\Plugin\views\fieldCode
public function render(ResultRow $values) {
$item = $values->_entity;
$timestamp = $item->started_date
->getString();
$created_date = $item->created
->getString();
$format = '';
if (intval($timestamp) - intval($created_date) < 5 && $item->is_interactive
->getString() == '1') {
$format = $this
->t('Not Started');
}
else {
if ($timestamp) {
$format = \Drupal::service('date.formatter')
->format($timestamp, $this->options['date_format']);
}
}
return $format;
}