function RulesReactionListBuilder::buildRow
Overrides EntityListBuilder::buildRow
1 call to RulesReactionListBuilder::buildRow()
- RulesReactionListBuilder::render in src/
Controller/ RulesReactionListBuilder.php - Builds the entity listing as renderable array for table.html.twig.
File
-
src/
Controller/ RulesReactionListBuilder.php, line 94
Class
- RulesReactionListBuilder
- Defines a class to build a listing of ReactionRuleConfig entities.
Namespace
Drupal\rules\ControllerCode
public function buildRow(EntityInterface $entity) {
$event_names = $entity->getEventNames();
$event_labels = [];
// List all Events that trigger this Rule.
foreach ($event_names as $event_name) {
$event_definition = $this->eventManager
->getDefinition($event_name);
$event_labels[] = $event_definition['label'];
}
/** @var \Drupal\rules\Entity\ReactionRuleConfig $entity */
$details = $this->t('Machine name: @name', [
'@name' => $entity->id(),
]);
if ($entity->hasTags()) {
$details = $details . '<br />' . $this->t('Tags: @tags', [
'@tags' => implode(', ', $entity->getTags()),
]);
}
$row['label']['data-drupal-selector'] = 'rules-table-filter-text-source';
$row['label']['data'] = [
'#plain_text' => $entity->label(),
'#suffix' => '<div class="description">' . $details . '</div>',
];
$row['event']['data-drupal-selector'] = 'rules-table-filter-text-source';
$row['event']['data'] = [
'#markup' => implode(",<br />", $event_labels),
];
$row['description']['data-drupal-selector'] = 'rules-table-filter-text-source';
$row['description']['data'] = [
'#type' => 'processed_text',
'#text' => $entity->getDescription(),
'#format' => 'restricted_html',
];
return $row + parent::buildRow($entity);
}