Commit a979bbda authored by webchick's avatar webchick

Issue #2110501 by tim.plunkett, pwolanin, tstoeckler: ControllerBase should...

Issue #2110501 by tim.plunkett, pwolanin, tstoeckler: ControllerBase should implement ContainerInjectionInterface like FormBase.
parent 0333c019
......@@ -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.
......@@ -100,6 +102,13 @@ abstract class ControllerBase {
*/
protected $formBuilder;
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static();
}
/**
* Retrieves the entity manager service.
*
......
......@@ -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.
......
......@@ -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.
......
......@@ -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 Drupal\field_ui\FieldUI;
use Symfony\Component\HttpFoundation\Request;
......@@ -20,7 +19,7 @@
/**
* Returns responses for comment module administrative routes.
*/
class AdminController extends ControllerBase implements ContainerInjectionInterface {
class AdminController extends ControllerBase {
/**
* The field info service.
......
......@@ -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.
......
......@@ -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.
......
......@@ -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\Language\LanguageManagerInterface;
use Drupal\Core\PathProcessor\InboundPathProcessorInterface;
......@@ -25,7 +24,7 @@
/**
* Provides page callbacks for the configuration translation interface.
*/
class ConfigTranslationController extends ControllerBase implements ContainerInjectionInterface {
class ConfigTranslationController extends ControllerBase {
/**
* The configuration mapper manager.
......
......@@ -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.
......
......@@ -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.
......
......@@ -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.
......
......@@ -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.
......
......@@ -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 @@ public static function create(ContainerInterface $container) {
$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 @@ public function metadata(Request $request) {
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 @@ public function fieldForm(EntityInterface $entity, $field_name, $langcode, $view
'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 @@ public function fieldForm(EntityInterface $entity, $field_name, $langcode, $view
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 @@ public function renderField(EntityInterface $entity, $field_name, $langcode, $vi
$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);
......
......@@ -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->hasViewBuilderClass()) {
$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->hasFormClasses()) {
$entity_types[$entity_type] = array(
'title' => $entity_info->getLabel(),
......
......@@ -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 @@ public function handleAutocomplete(Request $request, $type, $field_name, $entity
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();
}
......
......@@ -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 @@
/**
* 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 @@ 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')
);
}
......@@ -115,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)) {
......@@ -134,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)) {
......@@ -164,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)) {
......@@ -188,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');
}
/**
......@@ -203,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');
}
}
<?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 @@ public function helpMain() {
'#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 @@ 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'];
}
}
......@@ -81,7 +56,7 @@ protected function helpLinksAsList() {
$output = '<div class="clearfix"><div class="help-items"><ul>';