You are here

public function AbstractSolrEntityListBuilder::buildRow in Search API Solr 4.x

Same name and namespace in other branches
  1. 8.3 src/Controller/AbstractSolrEntityListBuilder.php \Drupal\search_api_solr\Controller\AbstractSolrEntityListBuilder::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()

1 call to AbstractSolrEntityListBuilder::buildRow()
SolrFieldTypeListBuilder::buildRow in src/Controller/SolrFieldTypeListBuilder.php
Builds a row for an entity in the entity listing.
1 method overrides AbstractSolrEntityListBuilder::buildRow()
SolrFieldTypeListBuilder::buildRow in src/Controller/SolrFieldTypeListBuilder.php
Builds a row for an entity in the entity listing.

File

src/Controller/AbstractSolrEntityListBuilder.php, line 63

Class

AbstractSolrEntityListBuilder
Provides a listing of Solr Entities.

Namespace

Drupal\search_api_solr\Controller

Code

public function buildRow(EntityInterface $solr_entity) {

  /** @var \Drupal\search_api_solr\SolrConfigInterface $solr_entity */
  $options = $solr_entity
    ->getOptions();
  if (empty($options)) {
    $options = [
      $this->default_option,
    ];
  }
  $enabled_label = $solr_entity->disabledOnServer ? $this
    ->t('Disabled') : $this
    ->t('Enabled');
  $enabled_icon = [
    '#theme' => 'image',
    '#uri' => !$solr_entity->disabledOnServer ? 'core/misc/icons/73b355/check.svg' : 'core/misc/icons/e32700/error.svg',
    '#width' => 18,
    '#height' => 18,
    '#alt' => $enabled_label,
    '#title' => $enabled_label,
  ];
  $row = [
    'label' => $solr_entity
      ->label(),
    'minimum_solr_version' => $solr_entity
      ->getMinimumSolrVersion(),
    // @todo format
    'options' => implode(', ', $options),
    'id' => $solr_entity
      ->id(),
    'enabled' => [
      'data' => $enabled_icon,
      'class' => [
        'checkbox',
      ],
    ],
  ];
  return $row + parent::buildRow($solr_entity);
}