diff --git a/core/lib/Drupal/Core/Entity/Controller/EntityViewController.php b/core/lib/Drupal/Core/Entity/Controller/EntityViewController.php
index 2be0b5e..38e5424 100644
--- a/core/lib/Drupal/Core/Entity/Controller/EntityViewController.php
+++ b/core/lib/Drupal/Core/Entity/Controller/EntityViewController.php
@@ -18,32 +18,6 @@
class EntityViewController extends ControllerBase {
/**
- * The entity manager
- *
- * @var \Drupal\Core\Entity\EntityManagerInterface
- */
- protected $entityManager;
-
- /**
- * Creates an EntityListController object.
- *
- * @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')
- );
- }
-
- /**
* Provides a page to render a single entity.
*
* @param \Drupal\Core\Entity\EntityInterface $_entity
@@ -61,7 +35,7 @@ public static function create(ContainerInterface $container) {
* A render array as expected by drupal_render().
*/
public function view(EntityInterface $_entity, $view_mode = 'full', $langcode = NULL) {
- return $this->entityManager
+ return $this->entityManager()
->getViewBuilder($_entity->entityType())
->view($_entity, $view_mode, $langcode);
}
diff --git a/core/modules/block/lib/Drupal/block/Controller/CategoryAutocompleteController.php b/core/modules/block/lib/Drupal/block/Controller/CategoryAutocompleteController.php
index 2556211..02e9a4f 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\Controller\ControllerBase;
+use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
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 extends ControllerBase {
+class CategoryAutocompleteController implements ContainerInjectionInterface {
/**
* 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 2bf2a9b..b9920d2 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\Controller\ControllerBase;
+use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
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 extends ControllerBase {
+class BookController implements ContainerInjectionInterface {
/**
* The book manager.
diff --git a/core/modules/config/lib/Drupal/config/Controller/ConfigController.php b/core/modules/config/lib/Drupal/config/Controller/ConfigController.php
index 005ba54..a1e8510 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\Controller\ControllerBase;
+use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
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 extends ControllerBase {
+class ConfigController implements ContainerInjectionInterface {
/**
* The target storage.
diff --git a/core/modules/edit/lib/Drupal/edit/EditController.php b/core/modules/edit/lib/Drupal/edit/EditController.php
index 6be8d91..2c14041 100644
--- a/core/modules/edit/lib/Drupal/edit/EditController.php
+++ b/core/modules/edit/lib/Drupal/edit/EditController.php
@@ -7,13 +7,14 @@
namespace Drupal\edit;
-use Drupal\Core\Controller\ControllerBase;
+use Symfony\Component\DependencyInjection\ContainerAware;
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;
@@ -25,12 +26,13 @@
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 ControllerBase {
+class EditController extends ContainerAware implements ContainerInjectionInterface {
/**
* The TempStore factory.
@@ -216,14 +218,16 @@ 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('Drupal\edit\Form\EditFieldForm', $form_state);
+ $form = drupal_build_form($form_object->getFormId(), $form_state);
if (!empty($form_state['executed'])) {
// The form submission saved the entity in TempStore. Return the
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 4d786f7..6ee2db4 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/EntityReferenceController.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/EntityReferenceController.php
@@ -7,17 +7,18 @@
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 extends ControllerBase {
+class EntityReferenceController implements ContainerInjectionInterface {
/**
* 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 e2880f3..9222d1b 100644
--- a/core/modules/forum/lib/Drupal/forum/Controller/ForumController.php
+++ b/core/modules/forum/lib/Drupal/forum/Controller/ForumController.php
@@ -7,10 +7,7 @@
namespace Drupal\forum\Controller;
-use Drupal\Core\Config\Config;
use Drupal\Core\Controller\ControllerBase;
-use Drupal\Core\Entity\EntityManagerInterface;
-use Drupal\Core\StringTranslation\TranslationInterface;
use Drupal\forum\ForumManagerInterface;
use Drupal\taxonomy\TermInterface;
use Drupal\taxonomy\TermStorageControllerInterface;
@@ -30,20 +27,6 @@ class ForumController extends ControllerBase {
protected $forumManager;
/**
- * Entity Manager Service.
- *
- * @var \Drupal\Core\Entity\EntityManagerInterface
- */
- protected $entityManager;
-
- /**
- * Config object for forum.settings.
- *
- * @var \Drupal\Core\Config\Config
- */
- protected $config;
-
- /**
* Vocabulary storage controller.
*
* @var \Drupal\taxonomy\VocabularyStorageControllerInterface
@@ -58,35 +41,19 @@ class ForumController extends ControllerBase {
protected $termStorageController;
/**
- * Translation manager service.
- *
- * @var \Drupal\Core\StringTranslation\TranslationInterface
- */
- protected $translationManager;
-
- /**
* Constructs a ForumController object.
*
- * @param \Drupal\Core\Config\Config $config
- * Config object for forum.settings.
* @param \Drupal\forum\ForumManagerInterface $forum_manager
* The forum manager service.
* @param \Drupal\taxonomy\VocabularyStorageControllerInterface $vocabulary_storage_controller
* Vocabulary storage controller.
* @param \Drupal\taxonomy\TermStorageControllerInterface $term_storage_controller
* Term storage controller.
- * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
- * The entity manager service.
- * @param \Drupal\Core\StringTranslation\TranslationInterface $translation_manager
- * The translation manager service.
*/
- public function __construct(Config $config, ForumManagerInterface $forum_manager, VocabularyStorageControllerInterface $vocabulary_storage_controller, TermStorageControllerInterface $term_storage_controller, EntityManagerInterface $entity_manager, TranslationInterface $translation_manager) {
- $this->config = $config;
+ public function __construct(ForumManagerInterface $forum_manager, VocabularyStorageControllerInterface $vocabulary_storage_controller, TermStorageControllerInterface $term_storage_controller) {
$this->forumManager = $forum_manager;
$this->vocabularyStorageController = $vocabulary_storage_controller;
$this->termStorageController = $term_storage_controller;
- $this->entityManager = $entity_manager;
- $this->translationManager = $translation_manager;
}
/**
@@ -94,12 +61,9 @@ public function __construct(Config $config, ForumManagerInterface $forum_manager
*/
public static function create(ContainerInterface $container) {
return new static(
- $container->get('config.factory')->get('forum.settings'),
$container->get('forum_manager'),
$container->get('entity.manager')->getStorageController('taxonomy_vocabulary'),
- $container->get('entity.manager')->getStorageController('taxonomy_term'),
- $container->get('entity.manager'),
- $container->get('string_translation')
+ $container->get('entity.manager')->getStorageController('taxonomy_term')
);
}
@@ -114,7 +78,7 @@ public static function create(ContainerInterface $container) {
*/
public function forumPage(TermInterface $taxonomy_term) {
// Get forum details.
- $taxonomy_term->forums = $this->forumManager->getChildren($this->config->get('vocabulary'), $taxonomy_term->id());
+ $taxonomy_term->forums = $this->forumManager->getChildren($this->config('forum.settings')->get('vocabulary'), $taxonomy_term->id());
$taxonomy_term->parents = $this->forumManager->getParents($taxonomy_term->id());
if (empty($taxonomy_term->forum_container->value)) {
@@ -133,7 +97,7 @@ public function forumPage(TermInterface $taxonomy_term) {
* A render array.
*/
public function forumIndex() {
- $vocabulary = $this->vocabularyStorageController->load($this->config->get('vocabulary'));
+ $vocabulary = $this->vocabularyStorageController->load($this->config('forum.settings')->get('vocabulary'));
$index = $this->forumManager->getIndex();
$build = $this->build($index->forums, $index);
if (empty($index->forums)) {
@@ -163,14 +127,15 @@ public function forumIndex() {
* A render array.
*/
protected function build($forums, TermInterface $term, $topics = array(), $parents = array()) {
+ $config = $this->config('forum.settings');
$build = array(
'#theme' => 'forums',
'#forums' => $forums,
'#topics' => $topics,
'#parents' => $parents,
'#term' => $term,
- '#sortby' => $this->config->get('topics.order'),
- '#forums_per_page' => $this->config->get('topics.page_limit'),
+ '#sortby' => $config->get('topics.order'),
+ '#forums_per_page' => $config->get('topics.page_limit'),
);
$build['#attached']['library'][] = array('forum', 'forum.index');
if (empty($term->forum_container->value)) {
@@ -187,12 +152,12 @@ protected function build($forums, TermInterface $term, $topics = array(), $paren
* Render array for the add form.
*/
public function addForum() {
- $vid = $this->config->get('vocabulary');
+ $vid = $this->config('forum.settings')->get('vocabulary');
$taxonomy_term = $this->termStorageController->create(array(
'vid' => $vid,
'forum_controller' => 0,
));
- return $this->entityManager->getForm($taxonomy_term, 'forum');
+ return $this->entityManager()->getForm($taxonomy_term, 'forum');
}
/**
@@ -202,21 +167,12 @@ public function addForum() {
* Render array for the add form.
*/
public function addContainer() {
- $vid = $this->config->get('vocabulary');
+ $vid = $this->config('forum.settings')->get('vocabulary');
$taxonomy_term = $this->termStorageController->create(array(
'vid' => $vid,
'forum_container' => 1,
));
- return $this->entityManager->getForm($taxonomy_term, 'container');
- }
-
- /**
- * Translates a string to the current language or to a given language.
- *
- * See the t() documentation for details.
- */
- protected function t($string, array $args = array(), array $options = array()) {
- return $this->translationManager->translate($string, $args, $options);
+ return $this->entityManager()->getForm($taxonomy_term, 'container');
}
}
diff --git a/core/modules/help/lib/Drupal/help/Controller/HelpController.php b/core/modules/help/lib/Drupal/help/Controller/HelpController.php
index 00652bb..59cf945 100644
--- a/core/modules/help/lib/Drupal/help/Controller/HelpController.php
+++ b/core/modules/help/lib/Drupal/help/Controller/HelpController.php
@@ -8,8 +8,6 @@
namespace Drupal\help\Controller;
use Drupal\Core\Controller\ControllerBase;
-use Drupal\Core\Extension\ModuleHandlerInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Drupal\Component\Utility\String;
@@ -19,30 +17,6 @@
class HelpController extends ControllerBase {
/**
- * Stores the module handler.
- *
- * @var \Drupal\Core\Extension\ModuleHandlerInterface
- */
- protected $moduleHandler;
-
- /**
- * Constructs a \Drupal\help\Controller\HelpController object.
- *
- * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
- * The module handler.
- */
- public function __construct(ModuleHandlerInterface $module_handler) {
- $this->moduleHandler = $module_handler;
- }
-
- /**
- * {@inheritdoc}
- */
- public static function create(ContainerInterface $container) {
- return new static($container->get('module_handler'));
- }
-
- /**
* Prints a page listing a glossary of Drupal terminology.
*
* @return string
@@ -53,7 +27,7 @@ public function helpMain() {
'#attached' => array(
'css' => array(drupal_get_path('module', 'help') . '/css/help.module.css'),
),
- '#markup' => '
' . t('Help topics') . '
' . t('Help is available on the following items:') . '
' . $this->helpLinksAsList(),
+ '#markup' => '' . $this->t('Help topics') . '
' . $this->t('Help is available on the following items:') . '
' . $this->helpLinksAsList(),
);
return $output;
}
@@ -69,8 +43,8 @@ protected function helpLinksAsList() {
$module_info = system_rebuild_module_data();
$modules = array();
- foreach ($this->moduleHandler->getImplementations('help') as $module) {
- if ($this->moduleHandler->invoke($module, 'help', array("admin/help#$module", $empty_arg))) {
+ foreach ($this->moduleHandler()->getImplementations('help') as $module) {
+ if ($this->moduleHandler()->invoke($module, 'help', array("admin/help#$module", $empty_arg))) {
$modules[$module] = $module_info[$module]->info['name'];
}
}
@@ -82,7 +56,7 @@ protected function helpLinksAsList() {
$output = '';
$i = 0;
foreach ($modules as $module => $name) {
- $output .= '- ' . l($name, 'admin/help/' . $module) . '
';
+ $output .= '- ' . $this->l($name, 'help.page', array('name' => $module)) . '
';
if (($i + 1) % $break == 0 && ($i + 1) != $count) {
$output .= '
';
}
@@ -106,13 +80,13 @@ protected function helpLinksAsList() {
*/
public function helpPage($name) {
$build = array();
- if ($this->moduleHandler->implementsHook($name, 'help')) {
+ if ($this->moduleHandler()->implementsHook($name, 'help')) {
$info = system_get_info('module');
$build['#title'] = String::checkPlain($info[$name]['name']);
- $temp = $this->moduleHandler->invoke($name, 'help', array("admin/help#$name", drupal_help_arg()));
+ $temp = $this->moduleHandler()->invoke($name, 'help', array("admin/help#$name", drupal_help_arg()));
if (empty($temp)) {
- $build['top']['#markup'] = t('No help is available for module %module.', array('%module' => $info[$name]['name']));
+ $build['top']['#markup'] = $this->t('No help is available for module %module.', array('%module' => $info[$name]['name']));
}
else {
$build['top']['#markup'] = $temp;
@@ -132,7 +106,7 @@ public function helpPage($name) {
$build['links']['#links'] = array(
'#heading' => array(
'level' => 'h3',
- 'text' => t('@module administration pages', array('@module' => $info[$name]['name'])),
+ 'text' => $this->t('@module administration pages', array('@module' => $info[$name]['name'])),
),
'#links' => $links,
);
diff --git a/core/modules/language/tests/language_test/lib/Drupal/language_test/Controller/LanguageTestController.php b/core/modules/language/tests/language_test/lib/Drupal/language_test/Controller/LanguageTestController.php
index 733e3cb..001fe39 100644
--- a/core/modules/language/tests/language_test/lib/Drupal/language_test/Controller/LanguageTestController.php
+++ b/core/modules/language/tests/language_test/lib/Drupal/language_test/Controller/LanguageTestController.php
@@ -7,7 +7,7 @@
namespace Drupal\language_test\Controller;
-use Drupal\Core\Controller\ControllerBase;
+use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\HttpKernelInterface;
@@ -15,7 +15,7 @@
/**
* Controller routines for language_test routes.
*/
-class LanguageTestController extends ControllerBase {
+class LanguageTestController implements ContainerInjectionInterface {
/**
* The HTTP kernel service.
diff --git a/core/modules/menu/lib/Drupal/menu/Controller/MenuController.php b/core/modules/menu/lib/Drupal/menu/Controller/MenuController.php
index 445c723..65bba40 100644
--- a/core/modules/menu/lib/Drupal/menu/Controller/MenuController.php
+++ b/core/modules/menu/lib/Drupal/menu/Controller/MenuController.php
@@ -9,10 +9,7 @@
use Drupal\Component\Utility\Xss;
use Drupal\Core\Controller\ControllerBase;
-use Drupal\Core\Entity\EntityManagerInterface;
-use Drupal\menu_link\MenuLinkStorageControllerInterface;
use Drupal\system\MenuInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
@@ -22,43 +19,6 @@
class MenuController extends ControllerBase {
/**
- * The menu link storage.
- *
- * @var \Drupal\menu_link\MenuLinkStorageControllerInterface
- */
- protected $menuLinkStorage;
-
- /**
- * The entity manager.
- *
- * @var \Drupal\Core\Entity\EntityManagerInterface
- */
- protected $entityManager;
-
- /**
- * Constructs a new MenuController.
- *
- * @param \Drupal\menu_link\MenuLinkStorageControllerInterface $menu_link_storage
- * The storage controller.
- * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
- * The entity manager.
- */
- public function __construct(MenuLinkStorageControllerInterface $menu_link_storage, EntityManagerInterface $entity_manager) {
- $this->menuLinkStorage = $menu_link_storage;
- $this->entityManager = $entity_manager;
- }
-
- /**
- * {@inheritdoc}
- */
- public static function create(ContainerInterface $container) {
- return new static(
- $container->get('entity.manager')->getStorageController('menu_link'),
- $container->get('entity.manager')
- );
- }
-
- /**
* Gets all the available menus and menu items as a JavaScript array.
*
* @param \Symfony\Component\HttpFoundation\Request $request
@@ -89,12 +49,12 @@ public function getParentOptions(Request $request) {
* Returns the menu link submission form.
*/
public function addLink(MenuInterface $menu) {
- $menu_link = $this->menuLinkStorage->create(array(
+ $menu_link = $this->entityManager()->getStorageController('menu_link')->create(array(
'mlid' => 0,
'plid' => 0,
'menu_name' => $menu->id(),
));
- return $this->entityManager->getForm($menu_link);
+ return $this->entityManager()->getForm($menu_link);
}
/**
diff --git a/core/modules/system/lib/Drupal/system/Controller/AdminController.php b/core/modules/system/lib/Drupal/system/Controller/AdminController.php
index 0b30af4..7fe7c7b 100644
--- a/core/modules/system/lib/Drupal/system/Controller/AdminController.php
+++ b/core/modules/system/lib/Drupal/system/Controller/AdminController.php
@@ -8,8 +8,6 @@
namespace Drupal\system\Controller;
use Drupal\Core\Controller\ControllerBase;
-use Drupal\Core\Extension\ModuleHandlerInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Controller for admin section.
@@ -17,32 +15,6 @@
class AdminController extends ControllerBase {
/**
- * Module handler service.
- *
- * @var \Drupal\Core\Extension\ModuleHandlerInterface
- */
- protected $moduleHandler;
-
- /**
- * Constructs an AdminController object.
- *
- * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
- * Module Handler Service.
- */
- public function __construct(ModuleHandlerInterface $module_handler) {
- $this->moduleHandler = $module_handler;
- }
-
- /**
- * {@inheritdoc}
- */
- public static function create(ContainerInterface $container) {
- return new static(
- $container->get('module_handler')
- );
- }
-
- /**
* Prints a listing of admin tasks, organized by module.
*
* @return array
@@ -55,7 +27,7 @@ public function index() {
$module_info[$module]->info = $info;
}
- $this->moduleHandler->loadInclude('system', 'admin.inc');
+ $this->moduleHandler()->loadInclude('system', 'admin.inc');
uasort($module_info, 'system_sort_modules_by_info_name');
$menu_items = array();
diff --git a/core/modules/system/lib/Drupal/system/Controller/SystemInfoController.php b/core/modules/system/lib/Drupal/system/Controller/SystemInfoController.php
index 7a338e5..3bfad98 100644
--- a/core/modules/system/lib/Drupal/system/Controller/SystemInfoController.php
+++ b/core/modules/system/lib/Drupal/system/Controller/SystemInfoController.php
@@ -7,15 +7,16 @@
namespace Drupal\system\Controller;
-use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Response;
+use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
+use Drupal\Core\Database\Connection;
use Drupal\system\SystemManager;
/**
* Returns responses for System Info routes.
*/
-class SystemInfoController extends ControllerBase {
+class SystemInfoController implements ContainerInjectionInterface {
/**
* System Manager Service.
diff --git a/core/modules/system/lib/Drupal/system/Controller/ThemeController.php b/core/modules/system/lib/Drupal/system/Controller/ThemeController.php
index 38fdb45..ece04d5 100644
--- a/core/modules/system/lib/Drupal/system/Controller/ThemeController.php
+++ b/core/modules/system/lib/Drupal/system/Controller/ThemeController.php
@@ -7,9 +7,7 @@
namespace Drupal\system\Controller;
-use Drupal\Core\Config\Config;
use Drupal\Core\Controller\ControllerBase;
-use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
@@ -20,32 +18,6 @@
class ThemeController extends ControllerBase {
/**
- * The system.theme config object.
- *
- * @var \Drupal\Core\Config\Config
- */
- protected $config;
-
- /**
- * Constructs a ThemeController object.
- *
- * @param \Drupal\Core\Config\Config $config
- * The config.
- */
- public function __construct(Config $config) {
- $this->config = $config;
- }
-
- /**
- * {@inheritdoc}
- */
- public static function create(ContainerInterface $container) {
- return new static(
- $container->get('config.factory')->get('system.theme')
- );
- }
-
- /**
* Disables a theme.
*
* @param \Symfony\Component\HttpFoundation\Request $request
@@ -60,6 +32,7 @@ public static function create(ContainerInterface $container) {
*/
public function disable(Request $request) {
$theme = $request->get('theme');
+ $config = $this->config('system.theme');
if (isset($theme)) {
// Get current list of themes.
@@ -68,7 +41,7 @@ public function disable(Request $request) {
// Check if the specified theme is one recognized by the system.
if (!empty($themes[$theme])) {
// Do not disable the default or admin theme.
- if ($theme === $this->config->get('default') || $theme === $this->config->get('admin')) {
+ if ($theme === $config->get('default') || $theme === $config->get('admin')) {
drupal_set_message(t('%theme is the default theme and cannot be disabled.', array('%theme' => $themes[$theme]->info['name'])), 'error');
}
else {
diff --git a/core/modules/system/lib/Drupal/system/MachineNameController.php b/core/modules/system/lib/Drupal/system/MachineNameController.php
index 9565d10..51085cd 100644
--- a/core/modules/system/lib/Drupal/system/MachineNameController.php
+++ b/core/modules/system/lib/Drupal/system/MachineNameController.php
@@ -9,7 +9,7 @@
use Drupal\Component\Transliteration\TransliterationInterface;
use Drupal\Component\Utility\Unicode;
-use Drupal\Core\Controller\ControllerBase;
+use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -17,7 +17,7 @@
/**
* Controller routines for machine name transliteration routes.
*/
-class MachineNameController extends ControllerBase {
+class MachineNameController implements ContainerInjectionInterface {
/**
* The transliteration helper.
diff --git a/core/modules/system/tests/modules/common_test/lib/Drupal/common_test/Controller/CommonTestController.php b/core/modules/system/tests/modules/common_test/lib/Drupal/common_test/Controller/CommonTestController.php
index c0e378e..12d287f 100644
--- a/core/modules/system/tests/modules/common_test/lib/Drupal/common_test/Controller/CommonTestController.php
+++ b/core/modules/system/tests/modules/common_test/lib/Drupal/common_test/Controller/CommonTestController.php
@@ -8,13 +8,21 @@
namespace Drupal\common_test\Controller;
use Drupal\Component\Utility\String;
-use Drupal\Core\Controller\ControllerBase;
+use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Response;
/**
* Controller routines for common_test routes.
*/
-class CommonTestController extends ControllerBase {
+class CommonTestController implements ContainerInjectionInterface {
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function create(ContainerInterface $container) {
+ return new static();
+ }
/**
* Returns links to the current page, with and without query strings.
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 545c02b..20c5d91 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,12 +7,20 @@
namespace Drupal\twig_extension_test;
-use Drupal\Core\Controller\ControllerBase;
+use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Controller routines for Twig extension test routes.
*/
-class TwigExtensionTestController extends ControllerBase {
+class TwigExtensionTestController implements ContainerInjectionInterface {
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function create(ContainerInterface $container) {
+ return new static();
+ }
/**
* 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 22f4ad7..9179de9 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,12 +7,20 @@
namespace Drupal\twig_theme_test;
-use Drupal\Core\Controller\ControllerBase;
+use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Controller routines for Twig theme test routes.
*/
-class TwigThemeTestController extends ControllerBase {
+class TwigThemeTestController implements ContainerInjectionInterface {
+
+ /**
+ * Creates the controller.
+ */
+ public static function create(ContainerInterface $container) {
+ return new static();
+ }
/**
* 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 b5ce856..9d76424 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\Controller\ControllerBase;
+use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
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 extends ControllerBase {
+class TermAutocompleteController implements ContainerInjectionInterface {
/**
* 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 e8bbb71..126be87 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,5 +1,4 @@
moduleHandler = $module_handler;
- }
-
- /**
- * {@inheritdoc}
- */
- public static function create(ContainerInterface $container) {
- return new static(
- $container->get('module_handler')
- );
- }
-
- /**
* Returns a page about the update status of projects.
*
* @return array
@@ -53,7 +25,7 @@ public function updateStatus() {
'#theme' => 'update_report'
);
if ($available = update_get_available(TRUE)) {
- $this->moduleHandler->loadInclude('update', 'compare.inc');
+ $this->moduleHandler()->loadInclude('update', 'compare.inc');
$build['#data'] = update_calculate_project_data($available);
}
else {
diff --git a/core/modules/user/lib/Drupal/user/Controller/UserAutocompleteController.php b/core/modules/user/lib/Drupal/user/Controller/UserAutocompleteController.php
index ad8d427..6021843 100644
--- a/core/modules/user/lib/Drupal/user/Controller/UserAutocompleteController.php
+++ b/core/modules/user/lib/Drupal/user/Controller/UserAutocompleteController.php
@@ -4,19 +4,19 @@
* @file
* Contains \Drupal\user\Controller\UserAutocompleteController.
*/
-
namespace Drupal\user\Controller;
-use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\DependencyInjection\ContainerInterface;
+
+use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\user\UserAutocomplete;
/**
* Controller routines for taxonomy user routes.
*/
-class UserAutocompleteController extends ControllerBase {
+class UserAutocompleteController implements ContainerInjectionInterface {
/**
* The user autocomplete helper class to find matching user names.
diff --git a/core/modules/views/lib/Drupal/views/Controller/ViewAjaxController.php b/core/modules/views/lib/Drupal/views/Controller/ViewAjaxController.php
index be001f6..307d63f 100644
--- a/core/modules/views/lib/Drupal/views/Controller/ViewAjaxController.php
+++ b/core/modules/views/lib/Drupal/views/Controller/ViewAjaxController.php
@@ -9,7 +9,6 @@
use Drupal\Component\Utility\Url;
use Drupal\Core\Ajax\ReplaceCommand;
-use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Entity\EntityStorageControllerInterface;
use Drupal\views\Ajax\ScrollTopCommand;
@@ -23,7 +22,7 @@
/**
* Defines a controller to load a view via AJAX.
*/
-class ViewAjaxController extends ControllerBase {
+class ViewAjaxController implements ContainerInjectionInterface {
/**
* The entity storage controller for views.
@@ -73,8 +72,6 @@ public static function create(ContainerInterface $container) {
*
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
* Thrown when the view was not found.
- * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
- * Thrown when the view was denied access.
*/
public function ajaxView(Request $request) {
$name = $request->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 d2175bb..ba0b10b 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\Controller\ControllerBase;
+use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
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 extends ControllerBase {
+class ViewPageController implements ContainerInjectionInterface {
/**
* The entity storage controller.