You are here

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

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

See also

\Drupal\Core\Entity\EntityListBuilder::render()

File

src/Controller/SolrFieldTypeListBuilder.php, line 34

Class

SolrFieldTypeListBuilder
Provides a listing of SolrFieldType.

Namespace

Drupal\search_api_solr\Controller

Code

public function buildRow(EntityInterface $solr_field_type) {

  /** @var \Drupal\search_api_solr\SolrFieldTypeInterface $solr_field_type */
  $domains = $solr_field_type
    ->getDomains();
  if (empty($domains)) {
    $domains = [
      'generic',
    ];
  }
  $enabled_label = $solr_field_type->disabledOnServer ? $this
    ->t('Disabled') : $this
    ->t('Enabled');
  $enabled_icon = [
    '#theme' => 'image',
    '#uri' => !$solr_field_type->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_field_type
      ->label(),
    'minimum_solr_version' => $solr_field_type
      ->getMinimumSolrVersion(),
    // @todo format
    'managed_schema' => $solr_field_type
      ->requiresManagedSchema(),
    // @todo format
    'langcode' => $solr_field_type
      ->getFieldTypeLanguageCode(),
    // @todo format
    'domains' => implode(', ', $domains),
    'id' => $solr_field_type
      ->id(),
    'enabled' => [
      'data' => $enabled_icon,
      'class' => [
        'checkbox',
      ],
    ],
  ];
  return $row + parent::buildRow($solr_field_type);
}