Mercurial > hg > isophonics-drupal-site
view core/modules/field_ui/src/Controller/EntityDisplayModeController.php @ 13:5fb285c0d0e3
Update Drupal core to 8.4.7 via Composer. Security update; I *think* we've
been lucky to get away with this so far, as we don't support self-registration
which seems to be used by the so-called "drupalgeddon 2" attack that 8.4.5
was vulnerable to.
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:33:26 +0100 |
parents | 4c8ae668cc8c |
children | af1871eacc83 |
line wrap: on
line source
<?php namespace Drupal\field_ui\Controller; use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Url; /** * Provides methods for entity display mode routes. */ class EntityDisplayModeController extends ControllerBase { /** * Provides a list of eligible entity types for adding view modes. * * @return array * A list of entity types to add a view mode for. */ public function viewModeTypeSelection() { $entity_types = []; foreach ($this->entityManager()->getDefinitions() as $entity_type_id => $entity_type) { if ($entity_type->get('field_ui_base_route') && $entity_type->hasViewBuilderClass()) { $entity_types[$entity_type_id] = [ 'title' => $entity_type->getLabel(), 'url' => Url::fromRoute('entity.entity_view_mode.add_form', ['entity_type_id' => $entity_type_id]), 'localized_options' => [], ]; } } return [ '#theme' => 'admin_block_content', '#content' => $entity_types, ]; } /** * Provides a list of eligible entity types for adding form modes. * * @return array * A list of entity types to add a form mode for. */ public function formModeTypeSelection() { $entity_types = []; foreach ($this->entityManager()->getDefinitions() as $entity_type_id => $entity_type) { if ($entity_type->get('field_ui_base_route') && $entity_type->hasFormClasses()) { $entity_types[$entity_type_id] = [ 'title' => $entity_type->getLabel(), 'url' => Url::fromRoute('entity.entity_form_mode.add_form', ['entity_type_id' => $entity_type_id]), 'localized_options' => [], ]; } } return [ '#theme' => 'admin_block_content', '#content' => $entity_types, ]; } }