You are here

public function ConfigTranslationListController::listing in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/config_translation/src/Controller/ConfigTranslationListController.php \Drupal\config_translation\Controller\ConfigTranslationListController::listing()

Provides the listing page for any entity type.

Parameters

string $mapper_id: The name of the mapper.

Return value

array A render array as expected by drupal_render().

Throws

\Symfony\Component\HttpKernel\Exception\NotFoundHttpException Throws an exception if a mapper plugin could not be instantiated from the mapper definition in the constructor.

1 string reference to 'ConfigTranslationListController::listing'
config_translation.routing.yml in core/modules/config_translation/config_translation.routing.yml
core/modules/config_translation/config_translation.routing.yml

File

core/modules/config_translation/src/Controller/ConfigTranslationListController.php, line 59
Contains \Drupal\config_translation\Controller\ConfigTranslationListController.

Class

ConfigTranslationListController
Defines the configuration translation list controller.

Namespace

Drupal\config_translation\Controller

Code

public function listing($mapper_id) {
  $mapper_definition = $this->mapperManager
    ->getDefinition($mapper_id);
  $mapper = $this->mapperManager
    ->createInstance($mapper_id, $mapper_definition);
  if (!$mapper) {
    throw new NotFoundHttpException();
  }
  $entity_type = $mapper
    ->getType();

  // If the mapper, for example the mapper for fields, has a custom list
  // controller defined, use it. Other mappers, for examples the ones for
  // node_type and block, fallback to the generic configuration translation
  // list controller.
  $build = $this
    ->entityManager()
    ->getHandler($entity_type, 'config_translation_list')
    ->setMapperDefinition($mapper_definition)
    ->render();
  $build['#title'] = $mapper
    ->getTypeLabel();
  return $build;
}