diff --git a/core/modules/locale/lib/Drupal/locale/Form/TranslateFormBase.php b/core/modules/locale/lib/Drupal/locale/Form/TranslateFormBase.php index 7ee89e2..5b2abbd 100644 --- a/core/modules/locale/lib/Drupal/locale/Form/TranslateFormBase.php +++ b/core/modules/locale/lib/Drupal/locale/Form/TranslateFormBase.php @@ -7,8 +7,11 @@ namespace Drupal\locale\Form; +use Drupal\Core\Controller\ControllerInterface; use Drupal\Core\Form\FormInterface; use Drupal\Core\Language\Language; +use Drupal\locale\StringStorageInterface; +use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; /** @@ -16,7 +19,33 @@ * * Provides methods for searching and filtering strings. */ -abstract class TranslateFormBase implements FormInterface { +abstract class TranslateFormBase implements ControllerInterface, FormInterface { + + /** + * The locale storage. + * + * @var \Drupal\locale\StringStorageInterface + */ + protected $localeStorage; + + /** + * Constructs a new TranslationFormBase object. + * + * @param \Drupal\locale\StringStorageInterface $locale_storage + * The locale storage. + */ + public function __construct(StringStorageInterface $locale_storage) { + $this->localeStorage = $locale_storage; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container) { + return new static( + $container->get('locale.storage') + ); + } /** * Builds a string search query and returns an array of string objects. @@ -57,7 +86,7 @@ protected function translateFilterLoadStrings(Request $request) { } } - return \Drupal::service('locale.storage')->getTranslations($conditions, $options); + return $this->localeStorage->getTranslations($conditions, $options); } /**