public function RuleListBuilder::buildRow in RNG - Events and Registrations 8
Same name and namespace in other branches
- 8.2 src/Lists/RuleListBuilder.php \Drupal\rng\Lists\RuleListBuilder::buildRow()
- 3.x src/Lists/RuleListBuilder.php \Drupal\rng\Lists\RuleListBuilder::buildRow()
Parameters
\Drupal\rng\RuleInterface $entity: A rule entity.
Overrides EntityListBuilder::buildRow
File
- src/
Lists/ RuleListBuilder.php, line 122
Class
- RuleListBuilder
- Builds a list of rng rules.
Namespace
Drupal\rng\ListsCode
public function buildRow(EntityInterface $entity) {
$row['id'] = $entity
->id();
$row['trigger'] = $entity
->getTriggerID();
$row['conditions']['data'] = array(
'#theme' => 'links',
'#links' => [],
'#attributes' => [
'class' => [
'links',
'inline',
],
],
);
foreach ($entity
->getConditions() as $condition) {
$row['conditions']['data']['#links'][] = array(
'title' => $this
->t('Edit', [
'@condition_id' => $condition
->id(),
'@condition' => $condition
->getPluginId(),
]),
'url' => $condition
->urlInfo('edit-form'),
'query' => $this->redirectDestination
->getAsArray(),
);
}
$row['actions']['data'] = array(
'#theme' => 'links',
'#links' => [],
'#attributes' => [
'class' => [
'links',
'inline',
],
],
);
foreach ($entity
->getActions() as $action) {
$row['actions']['data']['#links'][] = array(
'title' => $this
->t('Edit', [
'@action_id' => $action
->id(),
'@action' => $action
->getPluginId(),
]),
'url' => $action
->urlInfo('edit-form'),
'query' => $this->redirectDestination
->getAsArray(),
);
}
$row['status'] = $entity
->isActive() ? $this
->t('Active') : $this
->t('Inactive');
return $row + parent::buildRow($entity);
}