public function ScheduleListBuilder::buildRow in Business Rules 8
Same name and namespace in other branches
- 2.x src/ScheduleListBuilder.php \Drupal\business_rules\ScheduleListBuilder::buildRow()
Builds a row for an entity in the entity listing.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity for this row of the list.
Return value
array A render array structure of fields for this entity.
Overrides EntityListBuilder::buildRow
See also
\Drupal\Core\Entity\EntityListBuilder::render()
File
- src/
ScheduleListBuilder.php, line 39
Class
- ScheduleListBuilder
- Defines a class to build a listing of Schedule entities.
Namespace
Drupal\business_rulesCode
public function buildRow(EntityInterface $entity) {
if (!$entity
->id() || !$entity
->getTriggeredBy()) {
return [];
}
/* @var $entity \Drupal\business_rules\Entity\Schedule */
$row['id'] = $entity
->id();
$row['triggered_by'] = Link::createFromRoute($entity
->getTriggeredBy()
->id(), 'entity.business_rules_action.edit_form', [
'business_rules_action' => $entity
->getTriggeredBy()
->id(),
]);
$row['name'] = Link::createFromRoute($entity
->label(), 'entity.business_rules_schedule.edit_form', [
'business_rules_schedule' => $entity
->id(),
]);
$scheduled = $entity
->getScheduled() ? \Drupal::service('date.formatter')
->format($entity
->getScheduled(), 'medium') : '';
$executed = $entity
->getExecutedTime() ? \Drupal::service('date.formatter')
->format($entity
->getExecutedTime(), 'medium') : '';
$row['scheduled_date'] = $scheduled;
$row['executed'] = $entity
->isExecuted() ? $this
->t('Yes') : $this
->t('No');
$row['execution_date'] = $executed;
$search_string = $entity
->id() . ' ' . $entity
->label() . ' ' . $entity
->getTriggeredBy()
->id() . ' ' . $entity
->getName() . ' ' . $scheduled . ' ' . $executed;
$row['filter'] = [
'data' => [
[
'#markup' => '<span class="table-filter-text-source">' . $search_string . '</span>',
],
],
'style' => [
'display: none',
],
];
return $row + parent::buildRow($entity);
}