public function BusinessRuleListBuilder::buildRow in Business Rules 8
Same name and namespace in other branches
- 2.x src/BusinessRuleListBuilder.php \Drupal\business_rules\BusinessRuleListBuilder::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/
BusinessRuleListBuilder.php, line 37
Class
- BusinessRuleListBuilder
- Provides a listing of Rule entities.
Namespace
Drupal\business_rulesCode
public function buildRow(EntityInterface $entity) {
/** @var \Drupal\business_rules\Entity\BusinessRule $entity */
$status = $entity
->isEnabled() ? $this
->t('Enabled') : $this
->t('Disabled');
$row['label'] = $entity
->label();
$row['id'] = $entity
->id();
$row['event'] = $entity
->getReactsOnLabel();
$row['enabled'] = $status;
$row['entity'] = $entity
->getTargetEntityTypeLabel();
$row['bundle'] = $entity
->getTargetBundleLabel();
$row['description'] = $entity
->getDescription();
$row['tags'] = implode(', ', $entity
->getTags());
$search_string = $entity
->label() . ' ' . $entity
->id() . ' ' . $entity
->getReactsOnLabel() . ' ' . $status . ' ' . $entity
->getTargetEntityTypeLabel() . ' ' . $entity
->getTargetBundleLabel() . ' ' . $entity
->getDescription() . ' ' . implode(' ', $entity
->getTags());
$row['filter'] = [
'data' => [
[
'#markup' => '<span class="table-filter-text-source">' . $search_string . '</span>',
],
],
'style' => [
'display: none',
],
];
return $row + parent::buildRow($entity);
}