You are here

public function FacConfigListBuilder::buildRow in Fast Autocomplete 8

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/Controller/FacConfigListBuilder.php, line 66

Class

FacConfigListBuilder
Provides a listing of FacConfig.

Namespace

Drupal\fac\Controller

Code

public function buildRow(EntityInterface $entity) {
  $search_plugin = $this->searchPluginManager
    ->getDefinition($entity
    ->getSearchPluginId());
  $status_label = $entity
    ->status() ? $this
    ->t('Enabled') : $this
    ->t('Disabled');
  $status_icon = [
    '#theme' => 'image',
    '#uri' => $entity
      ->status() ? 'core/misc/icons/73b355/check.svg' : 'core/misc/icons/e32700/error.svg',
    '#width' => 18,
    '#height' => 18,
    '#alt' => $status_label,
    '#title' => $status_label,
  ];
  $row = [
    'label' => $entity
      ->label(),
    'id' => $entity
      ->id(),
    'search_plugin' => $search_plugin['name']
      ->render(),
    'input_selectors' => $entity
      ->getInputSelectors(),
    'status' => [
      'data' => $status_icon,
    ],
  ];
  return $row + parent::buildRow($entity);
}