Issue #2110501 by tim.plunkett, pwolanin, tstoeckler: ControllerBase should implement ContainerInjectionInterface like FormBase.

8.0.x
webchick 2014-02-02 19:12:30 -08:00
parent 0333c01966
commit a979bbda18
38 changed files with 107 additions and 436 deletions

View File

@ -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 @@ use Symfony\Component\HttpFoundation\RedirectResponse;
*
* @see \Drupal\Core\DependencyInjection\ContainerInjectionInterface
*/
abstract class ControllerBase {
abstract class ControllerBase implements ContainerInjectionInterface {
/**
* The entity manager.
@ -100,6 +102,13 @@ abstract class ControllerBase {
*/
protected $formBuilder;
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static();
}
/**
* Retrieves the entity manager service.
*

View File

@ -9,7 +9,6 @@ namespace Drupal\aggregator\Controller;
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 @@ use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
/**
* Returns responses for aggregator module routes.
*/
class AggregatorController extends ControllerBase implements ContainerInjectionInterface {
class AggregatorController extends ControllerBase {
/**
* The database connection.

View File

@ -9,13 +9,12 @@ namespace Drupal\custom_block\Controller;
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.

View File

@ -11,7 +11,6 @@ use Drupal\comment\CommentManagerInterface;
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 Drupal\field_ui\FieldUI;
use Symfony\Component\HttpFoundation\Request;
@ -20,7 +19,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Returns responses for comment module administrative routes.
*/
class AdminController extends ControllerBase implements ContainerInjectionInterface {
class AdminController extends ControllerBase {
/**
* The field info service.

View File

@ -12,7 +12,6 @@ use Drupal\comment\CommentManagerInterface;
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 @@ use Symfony\Component\HttpKernel\HttpKernelInterface;
*
* @see \Drupal\comment\Entity\Comment.
*/
class CommentController extends ControllerBase implements ContainerInjectionInterface {
class CommentController extends ControllerBase {
/**
* The HTTP kernel.

View File

@ -10,14 +10,13 @@ namespace Drupal\comment\Form;
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.

View File

@ -10,7 +10,6 @@ namespace Drupal\config_translation\Controller;
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\Language\LanguageManagerInterface;
use Drupal\Core\PathProcessor\InboundPathProcessorInterface;
@ -25,7 +24,7 @@ use Symfony\Component\Routing\Matcher\RequestMatcherInterface;
/**
* Provides page callbacks for the configuration translation interface.
*/
class ConfigTranslationController extends ControllerBase implements ContainerInjectionInterface {
class ConfigTranslationController extends ControllerBase {
/**
* The configuration mapper manager.

View File

@ -9,14 +9,13 @@ namespace Drupal\config_translation\Controller;
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.

View File

@ -10,7 +10,6 @@ namespace Drupal\config_translation\Controller;
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 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
*
* Groups all defined configuration mapper instances by weight.
*/
class ConfigTranslationMapperList extends ControllerBase implements ContainerInjectionInterface {
class ConfigTranslationMapperList extends ControllerBase {
/**
* A array of configuration mapper instances.

View File

@ -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 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* Controller routines for contact routes.
*/
class ContactController extends ControllerBase implements ContainerInjectionInterface {
class ContactController extends ControllerBase {
/**
* The flood service.

View File

@ -13,7 +13,6 @@ use Drupal\Component\Utility\Xss;
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 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Returns responses for dblog routes.
*/
class DbLogController extends ControllerBase implements ContainerInjectionInterface {
class DbLogController extends ControllerBase {
/**
* The database service.

View File

@ -7,29 +7,25 @@
namespace Drupal\edit;
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;
use Drupal\Core\Form\FormBuilderInterface;
use Drupal\field\FieldInfo;
use Drupal\edit\Ajax\FieldFormCommand;
use Drupal\edit\Ajax\FieldFormSavedCommand;
use Drupal\edit\Ajax\FieldFormValidationErrorsCommand;
use Drupal\edit\Ajax\EntitySavedCommand;
use Drupal\edit\Ajax\MetadataCommand;
use Drupal\user\TempStoreFactory;
/**
* Returns responses for Edit module routes.
*/
class EditController implements ContainerInjectionInterface {
class EditController extends ControllerBase {
/**
* The TempStore factory.
@ -52,13 +48,6 @@ class EditController implements ContainerInjectionInterface {
*/
protected $editorSelector;
/**
* The entity manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
*/
protected $entityManager;
/**
* The field info service.
*
@ -66,20 +55,6 @@ class EditController implements ContainerInjectionInterface {
*/
protected $fieldInfo;
/**
* The form builder.
*
* @var \Drupal\Core\Form\FormBuilderInterface
*/
protected $formBuilder;
/**
* The module handler.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;
/**
* Constructs a new EditController.
*
@ -89,23 +64,14 @@ class EditController implements ContainerInjectionInterface {
* The in-place editing metadata generator.
* @param \Drupal\edit\EditorSelectorInterface $editor_selector
* The in-place editor selector.
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
* @param \Drupal\field\FieldInfo $field_info
* The field info service.
* @param \Drupal\Core\Form\FormBuilderInterface $form_builder
* The form builder.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler.
*/
public function __construct(TempStoreFactory $temp_store_factory, MetadataGeneratorInterface $metadata_generator, EditorSelectorInterface $editor_selector, EntityManagerInterface $entity_manager, FieldInfo $field_info, FormBuilderInterface $form_builder, ModuleHandlerInterface $module_handler) {
public function __construct(TempStoreFactory $temp_store_factory, MetadataGeneratorInterface $metadata_generator, EditorSelectorInterface $editor_selector, FieldInfo $field_info) {
$this->tempStoreFactory = $temp_store_factory;
$this->metadataGenerator = $metadata_generator;
$this->editorSelector = $editor_selector;
$this->entityManager = $entity_manager;
$this->fieldInfo = $field_info;
$this->formBuilder = $form_builder;
$this->moduleHandler = $module_handler;
}
/**
@ -116,10 +82,7 @@ class EditController implements ContainerInjectionInterface {
$container->get('user.tempstore'),
$container->get('edit.metadata.generator'),
$container->get('edit.editor.selector'),
$container->get('entity.manager'),
$container->get('field.info'),
$container->get('form_builder'),
$container->get('module_handler')
$container->get('field.info')
);
}
@ -145,10 +108,10 @@ class EditController implements ContainerInjectionInterface {
list($entity_type, $entity_id, $field_name, $langcode, $view_mode) = explode('/', $field);
// Load the entity.
if (!$entity_type || !$this->entityManager->getDefinition($entity_type)) {
if (!$entity_type || !$this->entityManager()->getDefinition($entity_type)) {
throw new NotFoundHttpException();
}
$entity = $this->entityManager->getStorageController($entity_type)->load($entity_id);
$entity = $this->entityManager()->getStorageController($entity_type)->load($entity_id);
if (!$entity) {
throw new NotFoundHttpException();
}
@ -234,7 +197,7 @@ class EditController implements ContainerInjectionInterface {
'args' => array($entity, $field_name),
),
);
$form = $this->formBuilder->buildForm('Drupal\edit\Form\EditFieldForm', $form_state);
$form = $this->formBuilder()->buildForm('Drupal\edit\Form\EditFieldForm', $form_state);
if (!empty($form_state['executed'])) {
// The form submission saved the entity in TempStore. Return the
@ -265,7 +228,7 @@ class EditController implements ContainerInjectionInterface {
else {
$response->addCommand(new FieldFormCommand(drupal_render($form)));
$errors = $this->formBuilder->getErrors($form_state);
$errors = $this->formBuilder()->getErrors($form_state);
if (count($errors)) {
$status_messages = array(
'#theme' => 'status_messages'
@ -324,7 +287,7 @@ class EditController implements ContainerInjectionInterface {
$mode_id_parts = explode('-', $view_mode_id, 2);
$module = reset($mode_id_parts);
$args = array($entity, $field_name, $view_mode_id, $langcode);
$output = $this->moduleHandler->invoke($module, 'edit_render_field', $args);
$output = $this->moduleHandler()->invoke($module, 'edit_render_field', $args);
}
return drupal_render($output);

View File

@ -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 @@ class EntityDisplayModeController implements ContainerInjectionInterface {
*/
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->hasViewBuilderClass()) {
$entity_types[$entity_type] = array(
'title' => $entity_info->getLabel(),
@ -73,7 +45,7 @@ class EntityDisplayModeController implements ContainerInjectionInterface {
*/
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->hasFormClasses()) {
$entity_types[$entity_type] = array(
'title' => $entity_info->getLabel(),

View File

@ -7,18 +7,16 @@
namespace Drupal\entity_reference;
use Drupal\Core\Entity\EntityManagerInterface;
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\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.
@ -27,24 +25,14 @@ class EntityReferenceController implements ContainerInjectionInterface {
*/
protected $entityReferenceAutocomplete;
/**
* The entity manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
*/
protected $entityManager;
/**
* Constructs a EntityReferenceController object.
*
* @param \Drupal\entity_reference\EntityReferenceAutocomplete $entity_reference_autcompletion
* @param \Drupal\entity_reference\EntityReferenceAutocomplete $entity_reference_autocompletion
* The autocompletion helper for entity references.
* @param \Drupal\Core\Entity\EntityManagerInterface êntity_manager
* The entity manager.
*/
public function __construct(EntityReferenceAutocomplete $entity_reference_autcompletion, EntityManagerInterface $entity_manager) {
$this->entityReferenceAutocomplete = $entity_reference_autcompletion;
$this->entityManager = $entity_manager;
public function __construct(EntityReferenceAutocomplete $entity_reference_autocompletion) {
$this->entityReferenceAutocomplete = $entity_reference_autocompletion;
}
/**
@ -86,7 +74,7 @@ class EntityReferenceController implements ContainerInjectionInterface {
throw new AccessDeniedHttpException();
}
$access_controller = $this->entityManager->getAccessController($entity_type);
$access_controller = $this->entityManager()->getAccessController($entity_type);
if ($instance->getType() != 'entity_reference' || !$access_controller->fieldAccess('edit', $instance)) {
throw new AccessDeniedHttpException();
}

View File

@ -7,11 +7,7 @@
namespace Drupal\forum\Controller;
use Drupal\Core\Config\Config;
use Drupal\Core\Controller\ControllerInterface;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\StringTranslation\TranslationInterface;
use Drupal\Core\Controller\ControllerBase;
use Drupal\forum\ForumManagerInterface;
use Drupal\taxonomy\TermInterface;
use Drupal\taxonomy\TermStorageControllerInterface;
@ -21,7 +17,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Controller routines for forum routes.
*/
class ForumController implements ContainerInjectionInterface {
class ForumController extends ControllerBase {
/**
* Forum manager service.
@ -30,20 +26,6 @@ class ForumController implements ContainerInjectionInterface {
*/
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.
*
@ -58,36 +40,20 @@ class ForumController implements ContainerInjectionInterface {
*/
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;
}
/**
@ -95,12 +61,9 @@ class ForumController implements ContainerInjectionInterface {
*/
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')
);
}
@ -115,7 +78,7 @@ class ForumController implements ContainerInjectionInterface {
*/
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)) {
@ -134,7 +97,7 @@ class ForumController implements ContainerInjectionInterface {
* 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)) {
@ -164,14 +127,15 @@ class ForumController implements ContainerInjectionInterface {
* 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)) {
@ -188,12 +152,12 @@ class ForumController implements ContainerInjectionInterface {
* 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');
}
/**
@ -203,21 +167,12 @@ class ForumController implements ContainerInjectionInterface {
* 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');
}
}

View File

@ -1,4 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\help\Controller\HelpController.
@ -6,40 +7,14 @@
namespace Drupal\help\Controller;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Drupal\Component\Utility\String;
/**
* Controller routines for help routes.
*/
class HelpController implements ContainerInjectionInterface {
/**
* 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'));
}
class HelpController extends ControllerBase {
/**
* Prints a page listing a glossary of Drupal terminology.
@ -52,7 +27,7 @@ class HelpController implements ContainerInjectionInterface {
'#attached' => array(
'css' => array(drupal_get_path('module', 'help') . '/css/help.module.css'),
),
'#markup' => '<h2>' . t('Help topics') . '</h2><p>' . t('Help is available on the following items:') . '</p>' . $this->helpLinksAsList(),
'#markup' => '<h2>' . $this->t('Help topics') . '</h2><p>' . $this->t('Help is available on the following items:') . '</p>' . $this->helpLinksAsList(),
);
return $output;
}
@ -68,8 +43,8 @@ class HelpController implements ContainerInjectionInterface {
$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'];
}
}
@ -81,7 +56,7 @@ class HelpController implements ContainerInjectionInterface {
$output = '<div class="clearfix"><div class="help-items"><ul>';
$i = 0;
foreach ($modules as $module => $name) {
$output .= '<li>' . l($name, 'admin/help/' . $module) . '</li>';
$output .= '<li>' . $this->l($name, 'help.page', array('name' => $module)) . '</li>';
if (($i + 1) % $break == 0 && ($i + 1) != $count) {
$output .= '</ul></div><div class="help-items' . ($i + 1 == $break * 3 ? ' help-items-last' : '') . '"><ul>';
}
@ -105,13 +80,13 @@ class HelpController implements ContainerInjectionInterface {
*/
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;
@ -131,7 +106,7 @@ class HelpController implements ContainerInjectionInterface {
$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,
);

View File

@ -8,7 +8,6 @@
namespace Drupal\image\Controller;
use Drupal\Component\Utility\Crypt;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Image\ImageFactory;
use Drupal\Core\Lock\LockBackendInterface;
use Drupal\image\ImageStyleInterface;
@ -23,7 +22,7 @@ use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException;
/**
* Defines a controller to serve image styles.
*/
class ImageStyleDownloadController extends FileDownloadController implements ContainerInjectionInterface {
class ImageStyleDownloadController extends FileDownloadController {
/**
* The lock backend.

View File

@ -15,7 +15,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Provides an add form for image effects.
*/
class ImageEffectAddForm extends ImageEffectFormBase implements ContainerInjectionInterface {
class ImageEffectAddForm extends ImageEffectFormBase {
/**
* The image effect manager.

View File

@ -8,55 +8,15 @@
namespace Drupal\menu\Controller;
use Drupal\Component\Utility\Xss;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\menu_link\MenuLinkStorageControllerInterface;
use Drupal\Core\Controller\ControllerBase;
use Drupal\system\MenuInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
/**
* Returns responses for Menu routes.
*/
class MenuController implements ContainerInjectionInterface {
/**
* 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')
);
}
class MenuController extends ControllerBase {
/**
* Gets all the available menus and menu items as a JavaScript array.
@ -89,12 +49,12 @@ class MenuController implements ContainerInjectionInterface {
* 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);
}
/**

View File

@ -10,7 +10,6 @@ namespace Drupal\node\Form;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Form\ConfirmFormBase;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Component\Utility\String;
use Drupal\user\TempStoreFactory;
use Symfony\Component\HttpFoundation\RedirectResponse;
@ -19,7 +18,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Provides a node deletion confirmation form.
*/
class DeleteMultiple extends ConfirmFormBase implements ContainerInjectionInterface {
class DeleteMultiple extends ConfirmFormBase {
/**
* The array of nodes to delete.

View File

@ -7,7 +7,6 @@
namespace Drupal\node\Form;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Database\Connection;
use Drupal\Core\Entity\EntityStorageControllerInterface;
use Drupal\Core\Form\ConfirmFormBase;
@ -17,7 +16,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Provides a form for reverting a node revision.
*/
class NodeRevisionDeleteForm extends ConfirmFormBase implements ContainerInjectionInterface {
class NodeRevisionDeleteForm extends ConfirmFormBase {
/**
* The node revision.

View File

@ -7,7 +7,6 @@
namespace Drupal\node\Form;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Entity\EntityStorageControllerInterface;
use Drupal\Core\Form\ConfirmFormBase;
use Drupal\node\NodeInterface;
@ -16,7 +15,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Provides a form for reverting a node revision.
*/
class NodeRevisionRevertForm extends ConfirmFormBase implements ContainerInjectionInterface {
class NodeRevisionRevertForm extends ConfirmFormBase {
/**
* The node revision.

View File

@ -7,7 +7,6 @@
namespace Drupal\path\Form;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Form\ConfirmFormBase;
use Drupal\Core\Path\Path;
use Symfony\Component\DependencyInjection\ContainerInterface;
@ -15,7 +14,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Builds the form to delete a path alias.
*/
class DeleteForm extends ConfirmFormBase implements ContainerInjectionInterface {
class DeleteForm extends ConfirmFormBase {
/**
* The path crud service.

View File

@ -8,7 +8,6 @@
namespace Drupal\search\Controller;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\search\SearchPageInterface;
use Drupal\search\SearchPageRepositoryInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@ -17,7 +16,7 @@ use Symfony\Component\HttpFoundation\Request;
/**
* Route controller for search.
*/
class SearchController extends ControllerBase implements ContainerInjectionInterface {
class SearchController extends ControllerBase {
/**
* The search page repository.

View File

@ -7,40 +7,12 @@
namespace Drupal\system\Controller;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Controller\ControllerBase;
/**
* Controller for admin section.
*/
class AdminController implements ContainerInjectionInterface {
/**
* 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')
);
}
class AdminController extends ControllerBase {
/**
* Prints a listing of admin tasks, organized by module.
@ -82,4 +54,5 @@ class AdminController implements ContainerInjectionInterface {
return $output;
}
}

View File

@ -9,7 +9,6 @@ namespace Drupal\system\Controller;
use Drupal\Component\Utility\Json;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Entity\Query\QueryFactory;
use Drupal\Core\Extension\ThemeHandlerInterface;
use Drupal\Core\Form\FormBuilderInterface;
@ -20,7 +19,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Returns responses for System routes.
*/
class SystemController extends ControllerBase implements ContainerInjectionInterface {
class SystemController extends ControllerBase {
/**
* The entity query factory object.

View File

@ -7,9 +7,7 @@
namespace Drupal\system\Controller;
use Drupal\Core\Config\Config;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
@ -17,33 +15,7 @@ use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
/**
* Controller for theme handling.
*/
class ThemeController implements ContainerInjectionInterface {
/**
* 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')
);
}
class ThemeController extends ControllerBase {
/**
* Disables a theme.
@ -60,6 +32,7 @@ class ThemeController implements ContainerInjectionInterface {
*/
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 @@ class ThemeController implements ContainerInjectionInterface {
// 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 {

View File

@ -9,14 +9,13 @@ namespace Drupal\system;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\CronInterface;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Response;
/**
* Controller for Cron handling.
*/
class CronController extends ControllerBase implements ContainerInjectionInterface {
class CronController extends ControllerBase {
/**
* The cron service.

View File

@ -7,7 +7,6 @@
namespace Drupal\system\Form;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Form\ConfirmFormBase;
use Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface;
@ -17,7 +16,7 @@ use Symfony\Component\HttpFoundation\RedirectResponse;
/**
* Builds a confirmation form for enabling modules with dependencies.
*/
class ModulesListConfirmForm extends ConfirmFormBase implements ContainerInjectionInterface {
class ModulesListConfirmForm extends ConfirmFormBase {
/**
* The module handler service.

View File

@ -10,14 +10,13 @@ namespace Drupal\system\Form;
use Drupal\Core\Form\ConfirmFormBase;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
/**
* Builds a confirmation form to uninstall selected modules.
*/
class ModulesUninstallConfirmForm extends ConfirmFormBase implements ContainerInjectionInterface {
class ModulesUninstallConfirmForm extends ConfirmFormBase {
/**
* The module handler service.

View File

@ -8,21 +8,12 @@
namespace Drupal\common_test\Controller;
use Drupal\Component\Utility\String;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Response;
/**
* Controller routines for common_test routes.
*/
class CommonTestController implements ContainerInjectionInterface {
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static();
}
class CommonTestController {
/**
* Returns links to the current page, with and without query strings.

View File

@ -8,13 +8,12 @@ namespace Drupal\error_test\Controller;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Database\Connection;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Controller routines for error_test routes.
*/
class ErrorTestController extends ControllerBase implements ContainerInjectionInterface {
class ErrorTestController extends ControllerBase {
/**
* The database connection.

View File

@ -7,10 +7,8 @@
namespace Drupal\router_test;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Controller\ControllerBase;
use Drupal\user\UserInterface;
use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\HttpKernelInterface;
@ -18,7 +16,7 @@ use Symfony\Component\HttpKernel\HttpKernelInterface;
/**
* Test controllers that are intended to be wrapped in a main controller.
*/
class TestContent extends ContainerAware implements ContainerInjectionInterface {
class TestContent extends ControllerBase {
/**
* The HTTP kernel.
@ -55,13 +53,13 @@ class TestContent extends ContainerAware implements ContainerInjectionInterface
* The user name of the current logged in user.
*/
public function test11() {
$account = \Drupal::currentUser();
$account = $this->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();
}

View File

@ -7,20 +7,10 @@
namespace Drupal\twig_extension_test;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Controller routines for Twig extension test routes.
*/
class TwigExtensionTestController implements ContainerInjectionInterface {
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static();
}
class TwigExtensionTestController {
/**
* Menu callback for testing Twig filters in a Twig template.

View File

@ -7,20 +7,10 @@
namespace Drupal\twig_theme_test;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* 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 {
/**
* Menu callback for testing PHP variables in a Twig template.

View File

@ -1,4 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\tour_test\Controller\TourTestController.
@ -6,20 +7,10 @@
namespace Drupal\tour_test\Controller;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Controller routines for tour_test routes.
*/
class TourTestController implements ContainerInjectionInterface {
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static();
}
class TourTestController {
/**
* Outputs some content for testing tours.

View File

@ -7,22 +7,14 @@
namespace Drupal\update\Controller;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\update\UpdateManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Controller\ControllerBase;
/**
* Controller routines for update routes.
*/
class UpdateController implements ContainerInjectionInterface {
/**
* Module handler service.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;
class UpdateController extends ControllerBase {
/**
* Update manager service.
@ -34,14 +26,10 @@ class UpdateController implements ContainerInjectionInterface {
/**
* Constructs update status data.
*
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* Module Handler Service.
*
* @param \Drupal\update\UpdateManagerInterface $update_manager
* Update Manager Service.
*/
public function __construct(ModuleHandlerInterface $module_handler, UpdateManagerInterface $update_manager) {
$this->moduleHandler = $module_handler;
public function __construct(UpdateManagerInterface $update_manager) {
$this->updateManager = $update_manager;
}
@ -50,7 +38,6 @@ class UpdateController implements ContainerInjectionInterface {
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('module_handler'),
$container->get('update.manager')
);
}
@ -66,7 +53,7 @@ class UpdateController implements ContainerInjectionInterface {
'#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 {

View File

@ -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.
@ -41,20 +38,6 @@ 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.
*
@ -62,14 +45,10 @@ class ViewsUIController implements ContainerInjectionInterface {
* 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 @@ class ViewsUIController implements ContainerInjectionInterface {
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 @@ class ViewsUIController implements ContainerInjectionInterface {
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 @@ class ViewsUIController implements ContainerInjectionInterface {
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 @@ class ViewsUIController implements ContainerInjectionInterface {
}
// Otherwise, redirect back to the page.
return new RedirectResponse($this->urlGenerator->generate('views_ui.list', array(), TRUE));
return $this->redirect('views_ui.list');
}
/**