diff --git a/core/lib/Drupal/Core/Controller/ControllerBase.php b/core/lib/Drupal/Core/Controller/ControllerBase.php index 618bfee..d16fccf 100644 --- a/core/lib/Drupal/Core/Controller/ControllerBase.php +++ b/core/lib/Drupal/Core/Controller/ControllerBase.php @@ -7,6 +7,8 @@ namespace Drupal\Core\Controller; +use Drupal\Core\DependencyInjection\ContainerInjectionInterface; +use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\RedirectResponse; /** @@ -28,7 +30,7 @@ * * @see \Drupal\Core\DependencyInjection\ContainerInjectionInterface */ -abstract class ControllerBase { +abstract class ControllerBase implements ContainerInjectionInterface { /** * The entity manager. @@ -94,6 +96,13 @@ protected $moduleHandler; /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container) { + return new static(); + } + + /** * Retrieves the entity manager service. * * @return \Drupal\Core\Entity\EntityManagerInterface diff --git a/core/lib/Drupal/Core/Entity/Controller/EntityViewController.php b/core/lib/Drupal/Core/Entity/Controller/EntityViewController.php index d11e4a6..2be0b5e 100644 --- a/core/lib/Drupal/Core/Entity/Controller/EntityViewController.php +++ b/core/lib/Drupal/Core/Entity/Controller/EntityViewController.php @@ -7,7 +7,7 @@ namespace Drupal\Core\Entity\Controller; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; +use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityManagerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -15,7 +15,7 @@ /** * Defines a generic controller to render a single entity. */ -class EntityViewController implements ContainerInjectionInterface { +class EntityViewController extends ControllerBase { /** * The entity manager diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Controller/AggregatorController.php b/core/modules/aggregator/lib/Drupal/aggregator/Controller/AggregatorController.php index f9b25b9..e327627 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Controller/AggregatorController.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Controller/AggregatorController.php @@ -9,7 +9,6 @@ use Drupal\Component\Utility\Xss; use Drupal\Core\Controller\ControllerBase; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\aggregator\FeedInterface; use Drupal\aggregator\ItemInterface; use Drupal\Core\Database\Connection; @@ -21,7 +20,7 @@ /** * Returns responses for aggregator module routes. */ -class AggregatorController extends ControllerBase implements ContainerInjectionInterface { +class AggregatorController extends ControllerBase { /** * The database connection. diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Controller/CustomBlockController.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Controller/CustomBlockController.php index 6469baf..5f6c211 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Controller/CustomBlockController.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Controller/CustomBlockController.php @@ -9,13 +9,12 @@ use Drupal\Component\Plugin\PluginManagerInterface; use Drupal\Core\Controller\ControllerBase; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\Core\Entity\EntityStorageControllerInterface; use Drupal\custom_block\CustomBlockTypeInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; -class CustomBlockController extends ControllerBase implements ContainerInjectionInterface { +class CustomBlockController extends ControllerBase { /** * The entity manager. diff --git a/core/modules/block/lib/Drupal/block/Controller/CategoryAutocompleteController.php b/core/modules/block/lib/Drupal/block/Controller/CategoryAutocompleteController.php index 02e9a4f..2556211 100644 --- a/core/modules/block/lib/Drupal/block/Controller/CategoryAutocompleteController.php +++ b/core/modules/block/lib/Drupal/block/Controller/CategoryAutocompleteController.php @@ -9,7 +9,7 @@ use Drupal\block\Plugin\Type\BlockManager; use Drupal\Component\Utility\String; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; +use Drupal\Core\Controller\ControllerBase; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; @@ -17,7 +17,7 @@ /** * Returns autocomplete responses for block categories. */ -class CategoryAutocompleteController implements ContainerInjectionInterface { +class CategoryAutocompleteController extends ControllerBase { /** * The block manager. diff --git a/core/modules/book/lib/Drupal/book/Controller/BookController.php b/core/modules/book/lib/Drupal/book/Controller/BookController.php index b9920d2..2bf2a9b 100644 --- a/core/modules/book/lib/Drupal/book/Controller/BookController.php +++ b/core/modules/book/lib/Drupal/book/Controller/BookController.php @@ -9,7 +9,7 @@ use Drupal\book\BookManager; use Drupal\book\BookExport; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; +use Drupal\Core\Controller\ControllerBase; use Drupal\node\NodeInterface; use Symfony\Component\DependencyInjection\Container; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -19,7 +19,7 @@ /** * Controller routines for book routes. */ -class BookController implements ContainerInjectionInterface { +class BookController extends ControllerBase { /** * The book manager. diff --git a/core/modules/comment/lib/Drupal/comment/Controller/AdminController.php b/core/modules/comment/lib/Drupal/comment/Controller/AdminController.php index 7378585..a386c0d 100644 --- a/core/modules/comment/lib/Drupal/comment/Controller/AdminController.php +++ b/core/modules/comment/lib/Drupal/comment/Controller/AdminController.php @@ -11,7 +11,6 @@ use Drupal\field\FieldInfo; use Drupal\Component\Utility\String; use Drupal\Core\Controller\ControllerBase; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\Core\Form\FormBuilderInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -19,7 +18,7 @@ /** * Returns responses for comment module administrative routes. */ -class AdminController extends ControllerBase implements ContainerInjectionInterface { +class AdminController extends ControllerBase { /** * The field info service. diff --git a/core/modules/comment/lib/Drupal/comment/Controller/CommentController.php b/core/modules/comment/lib/Drupal/comment/Controller/CommentController.php index 15f09a7..0bcb021 100644 --- a/core/modules/comment/lib/Drupal/comment/Controller/CommentController.php +++ b/core/modules/comment/lib/Drupal/comment/Controller/CommentController.php @@ -12,7 +12,6 @@ use Drupal\field\FieldInfo; use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -26,7 +25,7 @@ * * @see \Drupal\comment\Entity\Comment. */ -class CommentController extends ControllerBase implements ContainerInjectionInterface { +class CommentController extends ControllerBase { /** * The HTTP kernel. diff --git a/core/modules/comment/lib/Drupal/comment/Form/ConfirmDeleteMultiple.php b/core/modules/comment/lib/Drupal/comment/Form/ConfirmDeleteMultiple.php index b791b30..0de4b8b 100644 --- a/core/modules/comment/lib/Drupal/comment/Form/ConfirmDeleteMultiple.php +++ b/core/modules/comment/lib/Drupal/comment/Form/ConfirmDeleteMultiple.php @@ -10,14 +10,13 @@ use Drupal\comment\CommentStorageControllerInterface; use Drupal\Component\Utility\String; use Drupal\Core\Cache\Cache; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\Core\Form\ConfirmFormBase; use Symfony\Component\DependencyInjection\ContainerInterface; /** * Provides the comment multiple delete confirmation form. */ -class ConfirmDeleteMultiple extends ConfirmFormBase implements ContainerInjectionInterface { +class ConfirmDeleteMultiple extends ConfirmFormBase { /** * The comment storage. diff --git a/core/modules/config/lib/Drupal/config/Controller/ConfigController.php b/core/modules/config/lib/Drupal/config/Controller/ConfigController.php index a1e8510..005ba54 100644 --- a/core/modules/config/lib/Drupal/config/Controller/ConfigController.php +++ b/core/modules/config/lib/Drupal/config/Controller/ConfigController.php @@ -9,7 +9,7 @@ use Drupal\Component\Archiver\ArchiveTar; use Drupal\Core\Config\StorageInterface; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; +use Drupal\Core\Controller\ControllerBase; use Drupal\system\FileDownloadController; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; @@ -17,7 +17,7 @@ /** * Returns responses for config module routes. */ -class ConfigController implements ContainerInjectionInterface { +class ConfigController extends ControllerBase { /** * The target storage. diff --git a/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationController.php b/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationController.php index 3eb0216..eb3be1c 100644 --- a/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationController.php +++ b/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationController.php @@ -10,7 +10,6 @@ use Drupal\config_translation\ConfigMapperManagerInterface; use Drupal\Core\Access\AccessManager; use Drupal\Core\Controller\ControllerBase; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\Core\Language\Language; use Drupal\Core\PathProcessor\InboundPathProcessorInterface; use Drupal\Core\Session\AccountInterface; @@ -24,7 +23,7 @@ /** * Provides page callbacks for the configuration translation interface. */ -class ConfigTranslationController extends ControllerBase implements ContainerInjectionInterface { +class ConfigTranslationController extends ControllerBase { /** * The configuration mapper manager. diff --git a/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationListController.php b/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationListController.php index 14bd763..42b2f6f 100644 --- a/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationListController.php +++ b/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationListController.php @@ -9,14 +9,13 @@ use Drupal\config_translation\ConfigMapperManagerInterface; use Drupal\Core\Controller\ControllerBase; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** * Defines the configuration translation list controller. */ -class ConfigTranslationListController extends ControllerBase implements ContainerInjectionInterface { +class ConfigTranslationListController extends ControllerBase { /** * The definition of the config mapper. diff --git a/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationMapperList.php b/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationMapperList.php index b2242fd..8b7f63f 100644 --- a/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationMapperList.php +++ b/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationMapperList.php @@ -10,7 +10,6 @@ use Drupal\Component\Utility\String; use Drupal\config_translation\ConfigMapperInterface; use Drupal\Core\Controller\ControllerBase; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -18,7 +17,7 @@ * * Groups all defined configuration mapper instances by weight. */ -class ConfigTranslationMapperList extends ControllerBase implements ContainerInjectionInterface { +class ConfigTranslationMapperList extends ControllerBase { /** * A array of configuration mapper instances. diff --git a/core/modules/contact/lib/Drupal/contact/Controller/ContactController.php b/core/modules/contact/lib/Drupal/contact/Controller/ContactController.php index ff5f71d..213cae4 100644 --- a/core/modules/contact/lib/Drupal/contact/Controller/ContactController.php +++ b/core/modules/contact/lib/Drupal/contact/Controller/ContactController.php @@ -8,7 +8,6 @@ namespace Drupal\contact\Controller; use Drupal\Core\Controller\ControllerBase; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\Core\Flood\FloodInterface; use Drupal\contact\CategoryInterface; use Drupal\user\UserInterface; @@ -20,7 +19,7 @@ /** * Controller routines for contact routes. */ -class ContactController extends ControllerBase implements ContainerInjectionInterface { +class ContactController extends ControllerBase { /** * The flood service. diff --git a/core/modules/dblog/lib/Drupal/dblog/Controller/DbLogController.php b/core/modules/dblog/lib/Drupal/dblog/Controller/DbLogController.php index bc61820..9728f35 100644 --- a/core/modules/dblog/lib/Drupal/dblog/Controller/DbLogController.php +++ b/core/modules/dblog/lib/Drupal/dblog/Controller/DbLogController.php @@ -13,7 +13,6 @@ use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Database\Connection; use Drupal\Core\Datetime\Date; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Form\FormBuilderInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -21,7 +20,7 @@ /** * Returns responses for dblog routes. */ -class DbLogController extends ControllerBase implements ContainerInjectionInterface { +class DbLogController extends ControllerBase { /** * The database service. diff --git a/core/modules/edit/lib/Drupal/edit/EditController.php b/core/modules/edit/lib/Drupal/edit/EditController.php index 2c14041..6be8d91 100644 --- a/core/modules/edit/lib/Drupal/edit/EditController.php +++ b/core/modules/edit/lib/Drupal/edit/EditController.php @@ -7,14 +7,13 @@ namespace Drupal\edit; -use Symfony\Component\DependencyInjection\ContainerAware; +use Drupal\Core\Controller\ControllerBase; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Drupal\Component\Utility\MapArray; use Drupal\Core\Ajax\AjaxResponse; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Extension\ModuleHandlerInterface; @@ -26,13 +25,12 @@ use Drupal\edit\Ajax\FieldFormValidationErrorsCommand; use Drupal\edit\Ajax\EntitySavedCommand; use Drupal\edit\Ajax\MetadataCommand; -use Drupal\edit\Form\EditFieldForm; use Drupal\user\TempStoreFactory; /** * Returns responses for Edit module routes. */ -class EditController extends ContainerAware implements ContainerInjectionInterface { +class EditController extends ControllerBase { /** * The TempStore factory. @@ -218,16 +216,14 @@ public function fieldForm(EntityInterface $entity, $field_name, $langcode, $view $this->tempStoreFactory->get('edit')->set($entity->uuid(), $entity); } - $form_object = EditFieldForm::create($this->container); $form_state = array( 'langcode' => $langcode, 'no_redirect' => TRUE, 'build_info' => array( 'args' => array($entity, $field_name), - 'callback_object' => $form_object, ), ); - $form = drupal_build_form($form_object->getFormId(), $form_state); + $form = drupal_build_form('Drupal\edit\Form\EditFieldForm', $form_state); if (!empty($form_state['executed'])) { // The form submission saved the entity in TempStore. Return the diff --git a/core/modules/entity/lib/Drupal/entity/Controller/EntityDisplayModeController.php b/core/modules/entity/lib/Drupal/entity/Controller/EntityDisplayModeController.php index e0f1d0f..ee224aa 100644 --- a/core/modules/entity/lib/Drupal/entity/Controller/EntityDisplayModeController.php +++ b/core/modules/entity/lib/Drupal/entity/Controller/EntityDisplayModeController.php @@ -7,40 +7,12 @@ namespace Drupal\entity\Controller; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; -use Drupal\Core\Entity\EntityManagerInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; +use Drupal\Core\Controller\ControllerBase; /** * Provides methods for entity display mode routes. */ -class EntityDisplayModeController implements ContainerInjectionInterface { - - /** - * The entity manager. - * - * @var \Drupal\Core\Entity\EntityManagerInterface - */ - protected $entityManager; - - /** - * Constructs a new EntityDisplayModeFormBase. - * - * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager - * The entity manager. - */ - public function __construct(EntityManagerInterface $entity_manager) { - $this->entityManager = $entity_manager; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('entity.manager') - ); - } +class EntityDisplayModeController extends ControllerBase { /** * Provides a list of eligible entity types for adding view modes. @@ -50,7 +22,7 @@ public static function create(ContainerInterface $container) { */ public function viewModeTypeSelection() { $entity_types = array(); - foreach ($this->entityManager->getDefinitions() as $entity_type => $entity_info) { + foreach ($this->entityManager()->getDefinitions() as $entity_type => $entity_info) { if ($entity_info->isFieldable() && $entity_info->hasController('view_builder')) { $entity_types[$entity_type] = array( 'title' => $entity_info->getLabel(), @@ -73,7 +45,7 @@ public function viewModeTypeSelection() { */ public function formModeTypeSelection() { $entity_types = array(); - foreach ($this->entityManager->getDefinitions() as $entity_type => $entity_info) { + foreach ($this->entityManager()->getDefinitions() as $entity_type => $entity_info) { if ($entity_info->isFieldable() && $entity_info->hasController('form')) { $entity_types[$entity_type] = array( 'title' => $entity_info->getLabel(), diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/EntityReferenceController.php b/core/modules/entity_reference/lib/Drupal/entity_reference/EntityReferenceController.php index 6ee2db4..4d786f7 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/EntityReferenceController.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/EntityReferenceController.php @@ -7,18 +7,17 @@ namespace Drupal\entity_reference; +use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Entity\EntityManagerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; -use Drupal\Core\Controller\ControllerInterface; /** * Defines route controller for entity reference. */ -class EntityReferenceController implements ContainerInjectionInterface { +class EntityReferenceController extends ControllerBase { /** * The autocomplete helper for entity references. diff --git a/core/modules/forum/lib/Drupal/forum/Controller/ForumController.php b/core/modules/forum/lib/Drupal/forum/Controller/ForumController.php index 2372e71..e2880f3 100644 --- a/core/modules/forum/lib/Drupal/forum/Controller/ForumController.php +++ b/core/modules/forum/lib/Drupal/forum/Controller/ForumController.php @@ -8,8 +8,7 @@ namespace Drupal\forum\Controller; use Drupal\Core\Config\Config; -use Drupal\Core\Controller\ControllerInterface; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; +use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\StringTranslation\TranslationInterface; use Drupal\forum\ForumManagerInterface; @@ -21,7 +20,7 @@ /** * Controller routines for forum routes. */ -class ForumController implements ContainerInjectionInterface { +class ForumController extends ControllerBase { /** * Forum manager service. diff --git a/core/modules/help/lib/Drupal/help/Controller/HelpController.php b/core/modules/help/lib/Drupal/help/Controller/HelpController.php index 7aac826..00652bb 100644 --- a/core/modules/help/lib/Drupal/help/Controller/HelpController.php +++ b/core/modules/help/lib/Drupal/help/Controller/HelpController.php @@ -1,4 +1,5 @@ currentUser(); return $account->getUsername(); } public function testAccount(UserInterface $user) { - $current_user = \Drupal::currentUser(); - $this->container->set('current_user', $user); + $current_user = $this->currentUser(); + \Drupal::getContainer()->set('current_user', $user); return $current_user->getUsername() . ':' . $user->getUsername(); } diff --git a/core/modules/system/tests/modules/twig_extension_test/lib/Drupal/twig_extension_test/TwigExtensionTestController.php b/core/modules/system/tests/modules/twig_extension_test/lib/Drupal/twig_extension_test/TwigExtensionTestController.php index 20c5d91..545c02b 100644 --- a/core/modules/system/tests/modules/twig_extension_test/lib/Drupal/twig_extension_test/TwigExtensionTestController.php +++ b/core/modules/system/tests/modules/twig_extension_test/lib/Drupal/twig_extension_test/TwigExtensionTestController.php @@ -7,20 +7,12 @@ namespace Drupal\twig_extension_test; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; +use Drupal\Core\Controller\ControllerBase; /** * Controller routines for Twig extension test routes. */ -class TwigExtensionTestController implements ContainerInjectionInterface { - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static(); - } +class TwigExtensionTestController extends ControllerBase { /** * Menu callback for testing Twig filters in a Twig template. diff --git a/core/modules/system/tests/modules/twig_theme_test/lib/Drupal/twig_theme_test/TwigThemeTestController.php b/core/modules/system/tests/modules/twig_theme_test/lib/Drupal/twig_theme_test/TwigThemeTestController.php index 9179de9..22f4ad7 100644 --- a/core/modules/system/tests/modules/twig_theme_test/lib/Drupal/twig_theme_test/TwigThemeTestController.php +++ b/core/modules/system/tests/modules/twig_theme_test/lib/Drupal/twig_theme_test/TwigThemeTestController.php @@ -7,20 +7,12 @@ namespace Drupal\twig_theme_test; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; +use Drupal\Core\Controller\ControllerBase; /** * Controller routines for Twig theme test routes. */ -class TwigThemeTestController implements ContainerInjectionInterface { - - /** - * Creates the controller. - */ - public static function create(ContainerInterface $container) { - return new static(); - } +class TwigThemeTestController extends ControllerBase { /** * Menu callback for testing PHP variables in a Twig template. diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Controller/TermAutocompleteController.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Controller/TermAutocompleteController.php index 9d76424..b5ce856 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Controller/TermAutocompleteController.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Controller/TermAutocompleteController.php @@ -10,7 +10,7 @@ use Drupal\Component\Utility\Tags; use Drupal\Component\Utility\Unicode; use Drupal\Component\Utility\String; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; +use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Entity\Query\QueryInterface; use Drupal\field\FieldInfo; use Drupal\taxonomy\TermStorageControllerInterface; @@ -23,7 +23,7 @@ /** * Returns autocomplete responses for taxonomy terms. */ -class TermAutocompleteController implements ContainerInjectionInterface { +class TermAutocompleteController extends ControllerBase { /** * Taxonomy term entity query interface. diff --git a/core/modules/tour/tests/tour_test/lib/Drupal/tour_test/Controller/TourTestController.php b/core/modules/tour/tests/tour_test/lib/Drupal/tour_test/Controller/TourTestController.php index 126be87..e8bbb71 100644 --- a/core/modules/tour/tests/tour_test/lib/Drupal/tour_test/Controller/TourTestController.php +++ b/core/modules/tour/tests/tour_test/lib/Drupal/tour_test/Controller/TourTestController.php @@ -1,4 +1,5 @@ request->get('view_name'); diff --git a/core/modules/views/lib/Drupal/views/Routing/ViewPageController.php b/core/modules/views/lib/Drupal/views/Routing/ViewPageController.php index ba0b10b..d2175bb 100644 --- a/core/modules/views/lib/Drupal/views/Routing/ViewPageController.php +++ b/core/modules/views/lib/Drupal/views/Routing/ViewPageController.php @@ -8,7 +8,7 @@ namespace Drupal\views\Routing; use Drupal\Component\Utility\String; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; +use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Entity\EntityStorageControllerInterface; use Drupal\views\ViewExecutableFactory; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -18,7 +18,7 @@ /** * Defines a page controller to execute and render a view. */ -class ViewPageController implements ContainerInjectionInterface { +class ViewPageController extends ControllerBase { /** * The entity storage controller. diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Controller/ViewsUIController.php b/core/modules/views_ui/lib/Drupal/views_ui/Controller/ViewsUIController.php index 90c1d58..bcc3618 100644 --- a/core/modules/views_ui/lib/Drupal/views_ui/Controller/ViewsUIController.php +++ b/core/modules/views_ui/lib/Drupal/views_ui/Controller/ViewsUIController.php @@ -7,25 +7,22 @@ namespace Drupal\views_ui\Controller; +use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\views\ViewExecutable; use Drupal\views\ViewStorageInterface; use Drupal\views_ui\ViewUI; use Drupal\views\ViewsData; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\JsonResponse; -use Symfony\Component\HttpFoundation\RedirectResponse; use Drupal\Core\Ajax\AjaxResponse; use Drupal\Core\Ajax\ReplaceCommand; -use Drupal\Core\Routing\UrlGeneratorInterface; -use Drupal\Core\Utility\LinkGeneratorInterface; /** * Returns responses for Views UI routes. */ -class ViewsUIController implements ContainerInjectionInterface { +class ViewsUIController extends ControllerBase { /** * Stores the Entity manager. @@ -42,34 +39,16 @@ class ViewsUIController implements ContainerInjectionInterface { protected $viewsData; /** - * The URL generator to use. - * - * @var \Drupal\Core\Routing\UrlGeneratorInterface - */ - protected $urlGenerator; - - /** - * The link generator to use. - * - * @var \Drupal\Core\Utility\LinkGeneratorInterface - */ - protected $linkGenerator; - - /** * Constructs a new \Drupal\views_ui\Controller\ViewsUIController object. * * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager * The Entity manager. * @param \Drupal\views\ViewsData views_data * The Views data cache object. - * @param \Drupal\Core\Routing\UrlGeneratorInterface - * The URL generator. */ - public function __construct(EntityManagerInterface $entity_manager, ViewsData $views_data, UrlGeneratorInterface $url_generator, LinkGeneratorInterface $link_generator) { + public function __construct(EntityManagerInterface $entity_manager, ViewsData $views_data) { $this->entityManager = $entity_manager; $this->viewsData = $views_data; - $this->urlGenerator = $url_generator; - $this->linkGenerator = $link_generator; } /** @@ -78,9 +57,7 @@ public function __construct(EntityManagerInterface $entity_manager, ViewsData $v public static function create(ContainerInterface $container) { return new static( $container->get('entity.manager'), - $container->get('views.views_data'), - $container->get('url_generator'), - $container->get('link_generator') + $container->get('views.views_data') ); } @@ -123,7 +100,7 @@ public function reportFields() { foreach ($fields as $field_name => $views) { $rows[$field_name]['data'][0] = check_plain($field_name); foreach ($views as $view) { - $rows[$field_name]['data'][1][] = $this->linkGenerator->generate($view, 'views_ui.edit', array('view' => $view)); + $rows[$field_name]['data'][1][] = $this->l($view, 'views_ui.edit', array('view' => $view)); } $rows[$field_name]['data'][1] = implode(', ', $rows[$field_name]['data'][1]); } @@ -151,7 +128,7 @@ public function reportPlugins() { foreach ($rows as &$row) { // Link each view name to the view itself. foreach ($row['views'] as $row_name => $view) { - $row['views'][$row_name] = $this->linkGenerator->generate($view, 'views_ui.edit', array('view' => $view)); + $row['views'][$row_name] = $this->l($view, 'views_ui.edit', array('view' => $view)); } $row['views'] = implode(', ', $row['views']); } @@ -194,7 +171,7 @@ public function ajaxOperation(ViewStorageInterface $view, $op, Request $request) } // Otherwise, redirect back to the page. - return new RedirectResponse($this->urlGenerator->generate('views_ui.list', array(), TRUE)); + return $this->redirect('views_ui.list'); } /**