You are here

SolrFieldTypeListBuilder.php in Apache Solr Multilingual 8

File

src/Controller/SolrFieldTypeListBuilder.php
View source
<?php

/**
 * @file
 * Contains Drupal\apachesolr_multilingual\Controller\SolrFieldTypeListBuilder.
 */
namespace Drupal\apachesolr_multilingual\Controller;

use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;

/**
 * Provides a listing of SolrFieldType.
 */
class SolrFieldTypeListBuilder extends ConfigEntityListBuilder {

  /**
   * {@inheritdoc}
   */
  public function buildHeader() {
    $header['label'] = $this
      ->t('Solr Field Type');
    $header['id'] = $this
      ->t('Machine name');
    return $header + parent::buildHeader();
  }

  /**
   * {@inheritdoc}
   */
  public function buildRow(EntityInterface $entity) {
    $row['label'] = $this
      ->getLabel($entity);
    $row['id'] = $entity
      ->id();

    // You probably want a few more properties here...
    return $row + parent::buildRow($entity);
  }

  /**
   * {@inheritdoc}
   */
  public function load() {

    // @todo filter by server
    $entity_ids = $this
      ->getEntityIds();
    $entities = $this->storage
      ->loadMultipleOverrideFree($entity_ids);

    // Sort the entities using the entity class's sort() method.
    // See \Drupal\Core\Config\Entity\ConfigEntityBase::sort().
    uasort($entities, array(
      $this->entityType
        ->getClass(),
      'sort',
    ));
    return $entities;
  }

}

Classes

Namesort descending Description
SolrFieldTypeListBuilder Provides a listing of SolrFieldType.