diff --git a/core/lib/Drupal/Core/Entity/EntityFormController.php b/core/lib/Drupal/Core/Entity/EntityFormController.php index ceb09de..b16f5cc 100644 --- a/core/lib/Drupal/Core/Entity/EntityFormController.php +++ b/core/lib/Drupal/Core/Entity/EntityFormController.php @@ -7,6 +7,8 @@ namespace Drupal\Core\Entity; +use Drupal\Core\Form\FormBase; +use Drupal\Core\StringTranslation\Translator\TranslatorInterface; use Drupal\entity\EntityFormDisplayInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Language\Language; @@ -15,7 +17,7 @@ /** * Base class for entity form controllers. */ -class EntityFormController implements EntityFormControllerInterface { +class EntityFormController extends FormBase implements EntityFormControllerInterface { /** * The name of the current operation. @@ -61,10 +63,7 @@ public static function createInstance(ContainerInterface $container, $entity_typ } /** - * Sets the operation for this form. - * - * @param string $operation - * The name of the current operation. + * {@inheritdoc} */ public function setOperation($operation) { // If NULL is passed, do not overwrite the operation. @@ -129,12 +128,6 @@ public function buildForm(array $form, array &$form_state) { /** * {@inheritdoc} */ - public function validateForm(array &$form, array &$form_state) { - } - - /** - * {@inheritdoc} - */ public function submitForm(array &$form, array &$form_state) { } @@ -269,7 +262,7 @@ protected function actions(array $form, array &$form_state) { return array( // @todo Rename the action key from submit to save. 'submit' => array( - '#value' => t('Save'), + '#value' => $this->t('Save'), '#validate' => array( array($this, 'validate'), ), @@ -279,7 +272,7 @@ protected function actions(array $form, array &$form_state) { ), ), 'delete' => array( - '#value' => t('Delete'), + '#value' => $this->t('Delete'), // No need to validate the form when deleting the entity. '#submit' => array( array($this, 'delete'), @@ -566,4 +559,13 @@ public function setFormDisplay(EntityFormDisplayInterface $form_display, array & public function getOperation() { return $this->operation; } + + /** + * {@inheritdoc} + */ + public function setTranslationManager(TranslatorInterface $translation_manager) { + $this->translationManager = $translation_manager; + return $this; + } + } diff --git a/core/lib/Drupal/Core/Entity/EntityFormControllerInterface.php b/core/lib/Drupal/Core/Entity/EntityFormControllerInterface.php index d52363c..9ce343e 100644 --- a/core/lib/Drupal/Core/Entity/EntityFormControllerInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityFormControllerInterface.php @@ -8,6 +8,7 @@ namespace Drupal\Core\Entity; use Drupal\Core\Form\BaseFormIdInterface; +use Drupal\Core\StringTranslation\Translator\TranslatorInterface; use Drupal\entity\EntityFormDisplayInterface; /** @@ -38,6 +39,14 @@ public function getFormLangcode(array $form_state); public function isDefaultFormLangcode(array $form_state); /** + * Sets the operation for this form. + * + * @param string $operation + * The name of the current operation. + */ + public function setOperation($operation); + + /** * Returns the operation identifying the form controller. * * @return string @@ -139,4 +148,15 @@ public function validate(array $form, array &$form_state); */ public function submit(array $form, array &$form_state); + /** + * Sets the translation manager for this form. + * + * @param \Drupal\Core\StringTranslation\Translator\TranslatorInterface $translation_manager + * The translation manager. + * + * @return self + * The entity form. + */ + public function setTranslationManager(TranslatorInterface $translation_manager); + } diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php index a662259..f6daa62 100644 --- a/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@ -230,12 +230,15 @@ public function getFormController($entity_type, $operation) { if (!isset($this->controllers['form'][$operation][$entity_type])) { $class = $this->getControllerClass($entity_type, 'form', $operation); if (in_array('Drupal\Core\Entity\EntityControllerInterface', class_implements($class))) { - $this->controllers['form'][$operation][$entity_type] = $class::createInstance($this->container, $entity_type, $this->getDefinition($entity_type)); + $controller = $class::createInstance($this->container, $entity_type, $this->getDefinition($entity_type)); } else { - $this->controllers['form'][$operation][$entity_type] = new $class($this->container->get('module_handler')); + $controller = new $class($this->container->get('module_handler')); } - $this->controllers['form'][$operation][$entity_type]->setOperation($operation); + + $controller->setTranslationManager($this->container->get('string_translation')); + $controller->setOperation($operation); + $this->controllers['form'][$operation][$entity_type] = $controller; } return $this->controllers['form'][$operation][$entity_type]; } diff --git a/core/lib/Drupal/Core/Form/ConfirmFormBase.php b/core/lib/Drupal/Core/Form/ConfirmFormBase.php index e5899c5..712b449 100644 --- a/core/lib/Drupal/Core/Form/ConfirmFormBase.php +++ b/core/lib/Drupal/Core/Form/ConfirmFormBase.php @@ -12,7 +12,7 @@ /** * Provides an generic base class for a confirmation form. */ -abstract class ConfirmFormBase implements ConfirmFormInterface { +abstract class ConfirmFormBase extends FormBase implements ConfirmFormInterface { /** * {@inheritdoc} @@ -82,10 +82,4 @@ public function buildForm(array $form, array &$form_state, Request $request = NU return $form; } - /** - * {@inheritdoc} - */ - public function validateForm(array &$form, array &$form_state) { - } - } diff --git a/core/lib/Drupal/Core/Form/FormBase.php b/core/lib/Drupal/Core/Form/FormBase.php new file mode 100644 index 0000000..5199f6b --- /dev/null +++ b/core/lib/Drupal/Core/Form/FormBase.php @@ -0,0 +1,74 @@ +translator()->translate($string, $args, $options); + } + + protected function translator() { + if (!$this->translationManager) { + $this->translationManager = \Drupal::translation(); + } + return $this->translationManager; + } + + public function setTranslator($translation_manager) { + $this->translationManager = $translationManager; + } + +} diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Form/SettingsForm.php b/core/modules/aggregator/lib/Drupal/aggregator/Form/SettingsForm.php index bb46647..92a158a 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Form/SettingsForm.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Form/SettingsForm.php @@ -7,6 +7,8 @@ namespace Drupal\aggregator\Form; +use Drupal\Core\Config\Context\ContextInterface; +use Drupal\Core\StringTranslation\Translator\TranslatorInterface; use Drupal\system\SystemConfigFormBase; use Drupal\Core\Config\ConfigFactory; use Drupal\aggregator\Plugin\AggregatorPluginManager; @@ -40,6 +42,10 @@ class SettingsForm extends SystemConfigFormBase { * * @param \Drupal\Core\Config\ConfigFactory $config_factory * The factory for configuration objects. + * @param \Drupal\Core\Config\Context\ContextInterface $context + * The configuration context to use. + * @param \Drupal\Core\StringTranslation\Translator\TranslatorInterface $translation_manager + * The translation manager. * @param \Drupal\aggregator\Plugin\AggregatorPluginManager $fetcher_manager * The aggregator fetcher plugin manager. * @param \Drupal\aggregator\Plugin\AggregatorPluginManager $parser_manager @@ -47,8 +53,9 @@ class SettingsForm extends SystemConfigFormBase { * @param \Drupal\aggregator\Plugin\AggregatorPluginManager $processor_manager * The aggregator processor plugin manager. */ - public function __construct(ConfigFactory $config_factory, AggregatorPluginManager $fetcher_manager, AggregatorPluginManager $parser_manager, AggregatorPluginManager $processor_manager) { - $this->configFactory = $config_factory; + public function __construct(ConfigFactory $config_factory, ContextInterface $context, TranslatorInterface $translation_manager, AggregatorPluginManager $fetcher_manager, AggregatorPluginManager $parser_manager, AggregatorPluginManager $processor_manager) { + parent::__construct($config_factory, $context, $translation_manager); + $this->managers = array( 'fetcher' => $fetcher_manager, 'parser' => $parser_manager, @@ -68,6 +75,8 @@ public function __construct(ConfigFactory $config_factory, AggregatorPluginManag public static function create(ContainerInterface $container) { return new static( $container->get('config.factory'), + $container->get('config.context.free'), + $container->get('string_translation'), $container->get('plugin.manager.aggregator.fetcher'), $container->get('plugin.manager.aggregator.parser'), $container->get('plugin.manager.aggregator.processor') diff --git a/core/modules/ban/lib/Drupal/ban/Form/BanDelete.php b/core/modules/ban/lib/Drupal/ban/Form/BanDelete.php index ac1aa91..47343a5 100644 --- a/core/modules/ban/lib/Drupal/ban/Form/BanDelete.php +++ b/core/modules/ban/lib/Drupal/ban/Form/BanDelete.php @@ -10,6 +10,7 @@ use Drupal\Core\Controller\ControllerInterface; use Drupal\Core\Form\ConfirmFormBase; use Drupal\ban\BanIpManager; +use Drupal\Core\StringTranslation\Translator\TranslatorInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; @@ -29,9 +30,14 @@ class BanDelete extends ConfirmFormBase implements ControllerInterface { /** * Constructs a new BanDelete object. * + * @param \Drupal\Core\StringTranslation\Translator\TranslatorInterface $translation_manager + * The translation manager. * @param \Drupal\ban\BanIpManager $ip_manager + * The IP manager. */ - public function __construct(BanIpManager $ip_manager) { + public function __construct(TranslatorInterface $translation_manager, BanIpManager $ip_manager) { + parent::__construct($translation_manager); + $this->ipManager = $ip_manager; } @@ -40,6 +46,7 @@ public function __construct(BanIpManager $ip_manager) { */ public static function create(ContainerInterface $container) { return new static( + $container->get('string_translation'), $container->get('ban.ip_manager') ); } @@ -55,14 +62,14 @@ public function getFormID() { * {@inheritdoc} */ public function getQuestion() { - return t('Are you sure you want to unblock %ip?', array('%ip' => $this->banIp)); + return $this->t('Are you sure you want to unblock %ip?', array('%ip' => $this->banIp)); } /** * {@inheritdoc} */ public function getConfirmText() { - return t('Delete'); + return $this->t('Delete'); } /** diff --git a/core/modules/config/lib/Drupal/config/Form/ConfigSync.php b/core/modules/config/lib/Drupal/config/Form/ConfigSync.php index 8c5cb96..4aa5b7d 100644 --- a/core/modules/config/lib/Drupal/config/Form/ConfigSync.php +++ b/core/modules/config/lib/Drupal/config/Form/ConfigSync.php @@ -7,11 +7,9 @@ namespace Drupal\config\Form; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; - +use Drupal\Core\Entity\EntityManager; +use Drupal\Core\Form\FormBase; use Drupal\Core\Controller\ControllerInterface; -use Drupal\Core\Form\FormInterface; use Drupal\Core\Config\StorageInterface; use Drupal\Core\Lock\LockBackendInterface; use Drupal\Core\Config\StorageComparer; @@ -20,12 +18,13 @@ use Drupal\Core\Config\ConfigFactory; use Drupal\Core\StringTranslation\Translator\TranslatorInterface; use Drupal\Core\Routing\PathBasedGeneratorInterface; -use \Drupal\Core\Entity\EntityManager; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\DependencyInjection\ContainerInterface; /** * Construct the storage changes in a configuration synchronization form. */ -class ConfigSync implements ControllerInterface, FormInterface { +class ConfigSync extends FormBase implements ControllerInterface { /** * The database lock object. @@ -66,14 +65,6 @@ class ConfigSync implements ControllerInterface, FormInterface { protected $entity_manager; /** - * The translation manager service. - * - * @var \Drupal\Core\StringTranslation\Translator\TranslatorInterface - */ - protected $translationManager; - - - /** * URL generator service. * * @var \Drupal\Core\Routing\PathBasedGeneratorInterface @@ -83,8 +74,6 @@ class ConfigSync implements ControllerInterface, FormInterface { /** * Constructs the object. * - * @param \Drupal\Core\Database\Connection; $database - * The database object. * @param \Drupal\Core\Config\StorageInterface $sourceStorage * The source storage object. * @param \Drupal\Core\Config\StorageInterface $targetStorage @@ -95,21 +84,22 @@ class ConfigSync implements ControllerInterface, FormInterface { * Event dispatcher. * @param \Drupal\Core\Config\ConfigFactory $config_factory * Configuration object factory. - * @param \Drupal\Core\Entity\EntityManager + * @param \Drupal\Core\Entity\EntityManager $entity_manager * Entity manager. * @param \Drupal\Core\StringTranslation\Translator\TranslatorInterface $translation_manager * The translation manager. * @param \Drupal\Core\Routing\PathBasedGeneratorInterface $url_generator * The url generator service. */ - public function __construct(StorageInterface $sourceStorage, StorageInterface $targetStorage, LockBackendInterface $lock, EventDispatcherInterface $event_dispatcher, ConfigFactory $config_factory, EntityManager $entity_manger, TranslatorInterface $translation_manager, PathBasedGeneratorInterface $url_generator) { + public function __construct(StorageInterface $sourceStorage, StorageInterface $targetStorage, LockBackendInterface $lock, EventDispatcherInterface $event_dispatcher, ConfigFactory $config_factory, EntityManager $entity_manager, TranslatorInterface $translation_manager, PathBasedGeneratorInterface $url_generator) { + parent::__construct($translation_manager); + $this->sourceStorage = $sourceStorage; $this->targetStorage = $targetStorage; $this->lock = $lock; $this->eventDispatcher = $event_dispatcher; $this->configFactory = $config_factory; - $this->entity_manager = $entity_manger; - $this->translationManager = $translation_manager; + $this->entity_manager = $entity_manager; $this->urlGenerator = $url_generator; } @@ -143,14 +133,14 @@ public function buildForm(array $form, array &$form_state) { $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', - '#value' => $this->translationManager->translate('Import all'), + '#value' => $this->t('Import all'), ); $source_list = $this->sourceStorage->listAll(); $config_comparer = new StorageComparer($this->sourceStorage, $this->targetStorage); if (empty($source_list) || !$config_comparer->createChangelist()->hasChanges()) { $form['no_changes'] = array( - '#markup' => $this->translationManager->translate('There are no configuration changes.'), + '#markup' => $this->t('There are no configuration changes.'), ); $form['actions']['#access'] = FALSE; return $form; @@ -194,7 +184,7 @@ public function buildForm(array $form, array &$form_state) { foreach ($config_files as $config_file) { $links['view_diff'] = array( - 'title' => $this->translationManager->translate('View differences'), + 'title' => $this->t('View differences'), 'href' => $this->urlGenerator->getPathFromRoute('config_diff', array('config_file' => $config_file)), 'attributes' => array( 'class' => array('use-ajax'), @@ -222,12 +212,6 @@ public function buildForm(array $form, array &$form_state) { /** * {@inheritdoc} */ - public function validateForm(array &$form, array &$form_state) { - } - - /** - * {@inheritdoc} - */ public function submitForm(array &$form, array &$form_state) { $config_importer = new ConfigImporter( $form_state['storage_comparer'], @@ -237,13 +221,13 @@ public function submitForm(array &$form, array &$form_state) { $this->lock ); if ($config_importer->alreadyImporting()) { - drupal_set_message($this->translationManager->translate('Another request may be synchronizing configuration already.')); + drupal_set_message($this->t('Another request may be synchronizing configuration already.')); } else{ try { $config_importer->import(); drupal_flush_all_caches(); - drupal_set_message($this->translationManager->translate('The configuration was imported successfully.')); + drupal_set_message($this->t('The configuration was imported successfully.')); } catch (ConfigException $e) { // Return a negative result for UI purposes. We do not differentiate @@ -252,7 +236,7 @@ public function submitForm(array &$form, array &$form_state) { // multiple developers or site builders attempt to do it without // coordinating. watchdog_exception('config_import', $e); - drupal_set_message($this->translationManager->translate('The import failed due to an error. Any errors have been logged.'), 'error'); + drupal_set_message($this->t('The import failed due to an error. Any errors have been logged.'), 'error'); } } } diff --git a/core/modules/image/lib/Drupal/image/Form/ImageStyleAddForm.php b/core/modules/image/lib/Drupal/image/Form/ImageStyleAddForm.php index 8af0640..64c2a37 100644 --- a/core/modules/image/lib/Drupal/image/Form/ImageStyleAddForm.php +++ b/core/modules/image/lib/Drupal/image/Form/ImageStyleAddForm.php @@ -7,8 +7,6 @@ namespace Drupal\image\Form; -use Drupal\image\Form\ImageStyleFormBase; - /** * Controller for image style addition forms. */ @@ -19,7 +17,7 @@ class ImageStyleAddForm extends ImageStyleFormBase { */ public function save(array $form, array &$form_state) { parent::save($form, $form_state); - drupal_set_message($this->translator->translate('Style %name was created.', array('%name' => $this->entity->label()))); + drupal_set_message($this->t('Style %name was created.', array('%name' => $this->entity->label()))); } /** @@ -27,7 +25,7 @@ public function save(array $form, array &$form_state) { */ public function actions(array $form, array &$form_state) { $actions = parent::actions($form, $form_state); - $actions['submit']['#value'] = $this->translator->translate('Create new style'); + $actions['submit']['#value'] = $this->t('Create new style'); return $actions; } diff --git a/core/modules/image/lib/Drupal/image/Form/ImageStyleEditForm.php b/core/modules/image/lib/Drupal/image/Form/ImageStyleEditForm.php index 0625cdd..5273fab 100644 --- a/core/modules/image/lib/Drupal/image/Form/ImageStyleEditForm.php +++ b/core/modules/image/lib/Drupal/image/Form/ImageStyleEditForm.php @@ -9,9 +9,7 @@ use Drupal\Core\Entity\EntityStorageControllerInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\StringTranslation\Translator\TranslatorInterface; use Drupal\image\ConfigurableImageEffectInterface; -use Drupal\image\Form\ImageStyleFormBase; use Drupal\image\ImageEffectManager; use Drupal\Component\Utility\String; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -37,11 +35,9 @@ class ImageStyleEditForm extends ImageStyleFormBase { * The storage controller. * @param \Drupal\image\ImageEffectManager $image_effect_manager * The image effect manager service. - * @param \Drupal\Core\StringTranslation\Translator\TranslatorInterface $translator - * The translator service. */ - public function __construct(ModuleHandlerInterface $module_handler, EntityStorageControllerInterface $image_style_storage, TranslatorInterface $translator, ImageEffectManager $image_effect_manager) { - parent::__construct($module_handler, $image_style_storage, $translator); + public function __construct(ModuleHandlerInterface $module_handler, EntityStorageControllerInterface $image_style_storage, ImageEffectManager $image_effect_manager) { + parent::__construct($module_handler, $image_style_storage); $this->imageEffectManager = $image_effect_manager; } @@ -52,7 +48,6 @@ public static function createInstance(ContainerInterface $container, $entity_typ return new static( $container->get('module_handler'), $container->get('plugin.manager.entity')->getStorageController($entity_type), - $container->get('string_translation'), $container->get('plugin.manager.image.effect') ); } @@ -63,7 +58,7 @@ public static function createInstance(ContainerInterface $container, $entity_typ public function form(array $form, array &$form_state) { // @todo Remove drupal_set_title() in http://drupal.org/node/1981644 - $title = $this->translator->translate('Edit style %name', array('%name' => $this->entity->label())); + $title = $this->t('Edit style %name', array('%name' => $this->entity->label())); drupal_set_title($title, PASS_THROUGH); $form['#tree'] = TRUE; @@ -73,7 +68,7 @@ public function form(array $form, array &$form_state) { $preview_arguments = array('#theme' => 'image_style_preview', '#style' => $this->entity); $form['preview'] = array( '#type' => 'item', - '#title' => $this->translator->translate('Preview'), + '#title' => $this->t('Preview'), '#markup' => drupal_render($preview_arguments), // Render preview above parent elements. '#weight' => -5, @@ -94,7 +89,7 @@ public function form(array $form, array &$form_state) { $form['effects'][$key]['summary'] = $effect->getSummary(); $form['effects'][$key]['weight'] = array( '#type' => 'weight', - '#title' => $this->translator->translate('Weight for @title', array('@title' => $effect->label())), + '#title' => $this->t('Weight for @title', array('@title' => $effect->label())), '#title_display' => 'invisible', '#default_value' => $effect->getWeight(), ); @@ -103,12 +98,12 @@ public function form(array $form, array &$form_state) { $is_configurable = $effect instanceof ConfigurableImageEffectInterface; if ($is_configurable) { $links['edit'] = array( - 'title' => $this->translator->translate('edit'), + 'title' => $this->t('edit'), 'href' => 'admin/config/media/image-styles/manage/' . $this->entity->id() . '/effects/' . $key, ); } $links['delete'] = array( - 'title' => $this->translator->translate('delete'), + 'title' => $this->t('delete'), 'href' => 'admin/config/media/image-styles/manage/' . $this->entity->id() . '/effects/' . $key . '/delete', ); $form['effects'][$key]['operations'] = array( @@ -117,13 +112,13 @@ public function form(array $form, array &$form_state) { ); $form['effects'][$key]['configure'] = array( '#type' => 'link', - '#title' => $this->translator->translate('edit'), + '#title' => $this->t('edit'), '#href' => 'admin/config/media/image-styles/manage/' . $this->entity->id() . '/effects/' . $key, '#access' => $is_configurable, ); $form['effects'][$key]['remove'] = array( '#type' => 'link', - '#title' => $this->translator->translate('delete'), + '#title' => $this->t('delete'), '#href' => 'admin/config/media/image-styles/manage/' . $this->entity->id() . '/effects/' . $key . '/delete', ); } @@ -143,20 +138,20 @@ public function form(array $form, array &$form_state) { ); $form['effects']['new']['new'] = array( '#type' => 'select', - '#title' => $this->translator->translate('Effect'), + '#title' => $this->t('Effect'), '#title_display' => 'invisible', '#options' => $new_effect_options, - '#empty_option' => $this->translator->translate('Select a new effect'), + '#empty_option' => $this->t('Select a new effect'), ); $form['effects']['new']['weight'] = array( '#type' => 'weight', - '#title' => $this->translator->translate('Weight for new effect'), + '#title' => $this->t('Weight for new effect'), '#title_display' => 'invisible', '#default_value' => count($form['effects']) - 1, ); $form['effects']['new']['add'] = array( '#type' => 'submit', - '#value' => $this->translator->translate('Add'), + '#value' => $this->t('Add'), '#validate' => array(array($this, 'effectValidate')), '#submit' => array(array($this, 'effectSave')), ); @@ -169,7 +164,7 @@ public function form(array $form, array &$form_state) { */ public function effectValidate($form, &$form_state) { if (!$form_state['values']['new']) { - form_error($form['effects']['new']['new'], $this->translator->translate('Select an effect to add.')); + form_error($form['effects']['new']['new'], $this->t('Select an effect to add.')); } } @@ -189,7 +184,7 @@ public function effectSave($form, &$form_state) { $status = parent::save($form, $form_state); if ($status == SAVED_UPDATED) { - drupal_set_message($this->translator->translate('Changes to the style have been saved.')); + drupal_set_message($this->t('Changes to the style have been saved.')); } // Check if this field has any configuration options. @@ -209,7 +204,7 @@ public function effectSave($form, &$form_state) { ); $effect_id = $this->entity->saveImageEffect($effect); if (!empty($effect_id)) { - drupal_set_message($this->translator->translate('The image effect was successfully applied.')); + drupal_set_message($this->t('The image effect was successfully applied.')); } } } @@ -225,7 +220,7 @@ public function save(array $form, array &$form_state) { } parent::save($form, $form_state); - drupal_set_message($this->translator->translate('Changes to the style have been saved.')); + drupal_set_message($this->t('Changes to the style have been saved.')); } /** @@ -233,7 +228,7 @@ public function save(array $form, array &$form_state) { */ public function actions(array $form, array &$form_state) { $actions = parent::actions($form, $form_state); - $actions['submit']['#value'] = $this->translator->translate('Update style'); + $actions['submit']['#value'] = $this->t('Update style'); return $actions; } diff --git a/core/modules/image/lib/Drupal/image/Form/ImageStyleFormBase.php b/core/modules/image/lib/Drupal/image/Form/ImageStyleFormBase.php index a050434..2516122 100644 --- a/core/modules/image/lib/Drupal/image/Form/ImageStyleFormBase.php +++ b/core/modules/image/lib/Drupal/image/Form/ImageStyleFormBase.php @@ -11,7 +11,6 @@ use Drupal\Core\Entity\EntityFormController; use Drupal\Core\Entity\EntityStorageControllerInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\StringTranslation\Translator\TranslatorInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -27,26 +26,16 @@ protected $imageStyleStorage; /** - * The translator service. - * - * @var \Drupal\Core\StringTranslation\Translator\TranslatorInterface - */ - protected $translator; - - /** * Constructs a base class for image style add and edit forms. * * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler service. * @param \Drupal\Core\Entity\EntityStorageControllerInterface $image_style_storage * The image style entity storage controller. - * @param \Drupal\Core\StringTranslation\Translator\TranslatorInterface $translator - * The translator service. */ - public function __construct(ModuleHandlerInterface $module_handler, EntityStorageControllerInterface $image_style_storage, TranslatorInterface $translator) { + public function __construct(ModuleHandlerInterface $module_handler, EntityStorageControllerInterface $image_style_storage) { parent::__construct($module_handler); $this->imageStyleStorage = $image_style_storage; - $this->translator = $translator; } /** @@ -55,8 +44,7 @@ public function __construct(ModuleHandlerInterface $module_handler, EntityStorag public static function createInstance(ContainerInterface $container, $entity_type, array $entity_info) { return new static( $container->get('module_handler'), - $container->get('plugin.manager.entity')->getStorageController($entity_type), - $container->get('string_translation') + $container->get('plugin.manager.entity')->getStorageController($entity_type) ); } @@ -67,7 +55,7 @@ public function form(array $form, array &$form_state) { $form['label'] = array( '#type' => 'textfield', - '#title' => $this->translator->translate('Image style name'), + '#title' => $this->t('Image style name'), '#default_value' => $this->entity->label(), '#required' => TRUE, ); diff --git a/core/modules/node/lib/Drupal/node/Form/DeleteMultiple.php b/core/modules/node/lib/Drupal/node/Form/DeleteMultiple.php index 381ae80..dd89767 100644 --- a/core/modules/node/lib/Drupal/node/Form/DeleteMultiple.php +++ b/core/modules/node/lib/Drupal/node/Form/DeleteMultiple.php @@ -11,6 +11,7 @@ use Drupal\Core\Controller\ControllerInterface; use Drupal\Core\Entity\EntityManager; use Drupal\Component\Utility\String; +use Drupal\Core\StringTranslation\TranslationManager; use Drupal\user\TempStoreFactory; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -45,12 +46,16 @@ class DeleteMultiple extends ConfirmFormBase implements ControllerInterface { /** * Constructs a DeleteMultiple form object. * + * @param \Drupal\Core\StringTranslation\TranslationManager + * The translation manager. * @param \Drupal\user\TempStoreFactory $temp_store_factory * The tempstore factory. * @param \Drupal\Core\Entity\EntityManager $manager * The entity manager. */ - public function __construct(TempStoreFactory $temp_store_factory, EntityManager $manager) { + public function __construct(TranslationManager $translation_manager, TempStoreFactory $temp_store_factory, EntityManager $manager) { + parent::__construct($translation_manager); + $this->tempStoreFactory = $temp_store_factory; $this->storageController = $manager->getStorageController('node'); } @@ -60,6 +65,7 @@ public function __construct(TempStoreFactory $temp_store_factory, EntityManager */ public static function create(ContainerInterface $container) { return new static( + $container->get('string_translation'), $container->get('user.tempstore'), $container->get('plugin.manager.entity') ); diff --git a/core/modules/node/lib/Drupal/node/Form/NodeRevisionDeleteForm.php b/core/modules/node/lib/Drupal/node/Form/NodeRevisionDeleteForm.php index 8c06d49..9ed7954 100644 --- a/core/modules/node/lib/Drupal/node/Form/NodeRevisionDeleteForm.php +++ b/core/modules/node/lib/Drupal/node/Form/NodeRevisionDeleteForm.php @@ -11,6 +11,7 @@ use Drupal\Core\Database\Connection; use Drupal\Core\Entity\EntityStorageControllerInterface; use Drupal\Core\Form\ConfirmFormBase; +use Drupal\Core\StringTranslation\TranslationManager; use Drupal\node\NodeInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; @@ -51,6 +52,8 @@ class NodeRevisionDeleteForm extends ConfirmFormBase implements ControllerInterf /** * Constructs a new NodeRevisionDeleteForm. * + * @param \Drupal\Core\StringTranslation\TranslationManager + * The translation manager. * @param \Drupal\Core\Entity\EntityStorageControllerInterface $node_storage * The node storage. * @param \Drupal\Core\Entity\EntityStorageControllerInterface $node_type_storage @@ -58,7 +61,9 @@ class NodeRevisionDeleteForm extends ConfirmFormBase implements ControllerInterf * @param \Drupal\Core\Database\Connection $connection * The database connection. */ - public function __construct(EntityStorageControllerInterface $node_storage, EntityStorageControllerInterface $node_type_storage, Connection $connection) { + public function __construct(TranslationManager $translation_manager, EntityStorageControllerInterface $node_storage, EntityStorageControllerInterface $node_type_storage, Connection $connection) { + parent::__construct($translation_manager); + $this->nodeStorage = $node_storage; $this->nodeTypeStorage = $node_type_storage; $this->connection = $connection; @@ -70,6 +75,7 @@ public function __construct(EntityStorageControllerInterface $node_storage, Enti public static function create(ContainerInterface $container) { $entity_manager = $container->get('plugin.manager.entity'); return new static( + $container->get('string_translation'), $entity_manager->getStorageController('node'), $entity_manager->getStorageController('node_type'), $container->get('database') diff --git a/core/modules/node/lib/Drupal/node/Form/NodeRevisionRevertForm.php b/core/modules/node/lib/Drupal/node/Form/NodeRevisionRevertForm.php index d4c69ec..d15b497 100644 --- a/core/modules/node/lib/Drupal/node/Form/NodeRevisionRevertForm.php +++ b/core/modules/node/lib/Drupal/node/Form/NodeRevisionRevertForm.php @@ -10,6 +10,7 @@ use Drupal\Core\Controller\ControllerInterface; use Drupal\Core\Entity\EntityStorageControllerInterface; use Drupal\Core\Form\ConfirmFormBase; +use Drupal\Core\StringTranslation\Translator\TranslatorInterface; use Drupal\node\NodeInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; @@ -36,10 +37,14 @@ class NodeRevisionRevertForm extends ConfirmFormBase implements ControllerInterf /** * Constructs a new NodeRevisionRevertForm. * + * @param \Drupal\Core\StringTranslation\Translator\TranslatorInterface $translation_manager + * The translation manager. * @param \Drupal\Core\Entity\EntityStorageControllerInterface $node_storage * The node storage. */ - public function __construct(EntityStorageControllerInterface $node_storage) { + public function __construct(TranslatorInterface $translation_manager, EntityStorageControllerInterface $node_storage) { + parent::__construct($translation_manager); + $this->nodeStorage = $node_storage; } @@ -48,6 +53,7 @@ public function __construct(EntityStorageControllerInterface $node_storage) { */ public static function create(ContainerInterface $container) { return new static( + $container->get('string_translation'), $container->get('plugin.manager.entity')->getStorageController('node') ); } diff --git a/core/modules/path/lib/Drupal/path/Form/DeleteForm.php b/core/modules/path/lib/Drupal/path/Form/DeleteForm.php index 2d4bcff..df8ab85 100644 --- a/core/modules/path/lib/Drupal/path/Form/DeleteForm.php +++ b/core/modules/path/lib/Drupal/path/Form/DeleteForm.php @@ -10,6 +10,7 @@ use Drupal\Core\Controller\ControllerInterface; use Drupal\Core\Form\ConfirmFormBase; use Drupal\Core\Path\Path; +use Drupal\Core\StringTranslation\Translator\TranslatorInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; @@ -35,10 +36,14 @@ class DeleteForm extends ConfirmFormBase implements ControllerInterface { /** * Constructs a \Drupal\Core\Path\Path object. * + * @param \Drupal\Core\StringTranslation\Translator\TranslatorInterface $translation_manager + * The translation manager. * @param \Drupal\Core\Path\Path $path * The path crud service. */ - public function __construct(Path $path) { + public function __construct(TranslatorInterface $translation_manager, Path $path) { + parent::__construct($translation_manager); + $this->path = $path; } @@ -47,6 +52,7 @@ public function __construct(Path $path) { */ public static function create(ContainerInterface $container) { return new static( + $container->get('string_translation'), $container->get('path.crud') ); } diff --git a/core/modules/search/lib/Drupal/search/Form/SearchSettingsForm.php b/core/modules/search/lib/Drupal/search/Form/SearchSettingsForm.php index eb63894..8463355 100644 --- a/core/modules/search/lib/Drupal/search/Form/SearchSettingsForm.php +++ b/core/modules/search/lib/Drupal/search/Form/SearchSettingsForm.php @@ -6,6 +6,7 @@ namespace Drupal\search\Form; +use Drupal\Core\StringTranslation\Translator\TranslatorInterface; use Drupal\system\SystemConfigFormBase; use Drupal\Core\Config\ConfigFactory; use Drupal\Core\Config\Context\ContextInterface; @@ -39,13 +40,15 @@ class SearchSettingsForm extends SystemConfigFormBase { * The configuration factory object that manages search settings. * @param \Drupal\Core\Config\Context\ContextInterface $context * The context interface + * @param \Drupal\Core\StringTranslation\Translator\TranslatorInterface $translation_manager + * The translation manager. * @param \Drupal\Core\Extension\ModuleHandler $module_handler * The module handler * @param \Drupal\Core\KeyValueStore\KeyValueStoreInterface $state * The state key/value store interface, gives access to state based config settings. */ - public function __construct(ConfigFactory $config_factory, ContextInterface $context, ModuleHandler $module_handler, KeyValueStoreInterface $state) { - parent::__construct($config_factory, $context); + public function __construct(ConfigFactory $config_factory, ContextInterface $context, TranslatorInterface $translation_manager, ModuleHandler $module_handler, KeyValueStoreInterface $state) { + parent::__construct($config_factory, $context, $translation_manager); $this->moduleHandler = $module_handler; $this->state = $state; } @@ -57,6 +60,7 @@ public static function create(ContainerInterface $container) { return new static( $container->get('config.factory'), $container->get('config.context.free'), + $container->get('string_translation'), $container->get('module_handler'), $container->get('state') ); diff --git a/core/modules/statistics/lib/Drupal/statistics/StatisticsSettingsForm.php b/core/modules/statistics/lib/Drupal/statistics/StatisticsSettingsForm.php index d1bb1c4..1c3c769 100644 --- a/core/modules/statistics/lib/Drupal/statistics/StatisticsSettingsForm.php +++ b/core/modules/statistics/lib/Drupal/statistics/StatisticsSettingsForm.php @@ -6,6 +6,8 @@ namespace Drupal\statistics; +use Drupal\Core\Config\Context\ContextInterface; +use Drupal\Core\StringTranslation\Translator\TranslatorInterface; use Drupal\system\SystemConfigFormBase; use Drupal\Core\Config\ConfigFactory; use Drupal\Core\Extension\ModuleHandler; @@ -28,11 +30,16 @@ class StatisticsSettingsForm extends SystemConfigFormBase { * * @param \Drupal\Core\Config\ConfigFactory $config_factory * The factory for configuration objects. + * @param \Drupal\Core\Config\Context\ContextInterface $context + * The configuration context to use. + * @param \Drupal\Core\StringTranslation\Translator\TranslatorInterface $translation_manager + * The translation manager. * @param \Drupal\Core\Extension\ModuleHandler $module_handler * The module handler. */ - public function __construct(ConfigFactory $config_factory, ModuleHandler $module_handler) { - $this->configFactory = $config_factory; + public function __construct(ConfigFactory $config_factory, ContextInterface $context, TranslatorInterface $translation_manager, ModuleHandler $module_handler) { + parent::__construct($config_factory, $context, $translation_manager); + $this->moduleHandler = $module_handler; } @@ -42,6 +49,8 @@ public function __construct(ConfigFactory $config_factory, ModuleHandler $module public static function create(ContainerInterface $container) { return new static( $container->get('config.factory'), + $container->get('config.context.free'), + $container->get('string_translation'), $container->get('module_handler') ); } diff --git a/core/modules/system/lib/Drupal/system/Form/CronForm.php b/core/modules/system/lib/Drupal/system/Form/CronForm.php index 31c599b..78af925 100644 --- a/core/modules/system/lib/Drupal/system/Form/CronForm.php +++ b/core/modules/system/lib/Drupal/system/Form/CronForm.php @@ -10,6 +10,7 @@ use Drupal\Core\Config\ConfigFactory; use Drupal\Core\Config\Context\ContextInterface; use Drupal\Core\KeyValueStore\KeyValueStoreInterface; +use Drupal\Core\StringTranslation\Translator\TranslatorInterface; use Drupal\system\SystemConfigFormBase; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -33,11 +34,13 @@ class CronForm extends SystemConfigFormBase { * The factory for configuration objects. * @param \Drupal\Core\Config\Context\ContextInterface $context * The configuration context used for this configuration object. + * @param \Drupal\Core\StringTranslation\Translator\TranslatorInterface $translation_manager + * The translation manager. * @param \Drupal\Core\KeyValueStore\KeyValueStoreInterface $state * The state key value store. */ - public function __construct(ConfigFactory $config_factory, ContextInterface $context, KeyValueStoreInterface $state) { - parent::__construct($config_factory, $context); + public function __construct(ConfigFactory $config_factory, ContextInterface $context, TranslatorInterface $translation_manager, KeyValueStoreInterface $state) { + parent::__construct($config_factory, $context, $translation_manager); $this->state = $state; } @@ -48,6 +51,7 @@ public static function create(ContainerInterface $container) { return new static( $container->get('config.factory'), $container->get('config.context.free'), + $container->get('string_translation'), $container->get('state') ); } diff --git a/core/modules/system/lib/Drupal/system/Form/DateFormatLocalizeResetForm.php b/core/modules/system/lib/Drupal/system/Form/DateFormatLocalizeResetForm.php index d3de481..9456281 100644 --- a/core/modules/system/lib/Drupal/system/Form/DateFormatLocalizeResetForm.php +++ b/core/modules/system/lib/Drupal/system/Form/DateFormatLocalizeResetForm.php @@ -10,6 +10,7 @@ use Drupal\Core\Controller\ControllerInterface; use Drupal\Core\Form\ConfirmFormBase; use Drupal\Core\Config\ConfigFactory; +use Drupal\Core\StringTranslation\Translator\TranslatorInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; @@ -34,8 +35,14 @@ class DateFormatLocalizeResetForm extends ConfirmFormBase implements ControllerI /** * Constructs a DateFormatLocalizeResetForm object. + * + * @param \Drupal\Core\StringTranslation\Translator\TranslatorInterface $translation_manager + * The translation manager. + * @param \Drupal\Core\Config\ConfigFactory $config_factory + * The config factory. */ - public function __construct(ConfigFactory $config_factory) { + public function __construct(TranslatorInterface $translation_manager, ConfigFactory $config_factory) { + parent::__construct($translation_manager); $this->configFactory = $config_factory; } @@ -44,6 +51,7 @@ public function __construct(ConfigFactory $config_factory) { */ public static function create(ContainerInterface $container) { return new static( + $container->get('string_translation'), $container->get('config.factory') ); } diff --git a/core/modules/system/lib/Drupal/system/Form/ImageToolkitForm.php b/core/modules/system/lib/Drupal/system/Form/ImageToolkitForm.php index 100553c..f304aa7 100644 --- a/core/modules/system/lib/Drupal/system/Form/ImageToolkitForm.php +++ b/core/modules/system/lib/Drupal/system/Form/ImageToolkitForm.php @@ -9,6 +9,7 @@ use Drupal\Core\Config\ConfigFactory; use Drupal\Core\Config\Context\ContextInterface; +use Drupal\Core\StringTranslation\Translator\TranslatorInterface; use Drupal\system\SystemConfigFormBase; use Drupal\system\Plugin\ImageToolkitManager; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -32,11 +33,13 @@ class ImageToolkitForm extends SystemConfigFormBase { * The factory for configuration objects. * @param \Drupal\Core\Config\Context\ContextInterface $context * The configuration context used for this configuration object. + * @param \Drupal\Core\StringTranslation\Translator\TranslatorInterface $translation_manager + * The translation manager. * @param \Drupal\system\Plugin\ImageToolkitManager $manager * The image toolkit plugin manager. */ - public function __construct(ConfigFactory $config_factory, ContextInterface $context, ImageToolkitManager $manager) { - parent::__construct($config_factory, $context); + public function __construct(ConfigFactory $config_factory, ContextInterface $context, TranslatorInterface $translation_manager, ImageToolkitManager $manager) { + parent::__construct($config_factory, $context, $translation_manager); foreach ($manager->getAvailableToolkits() as $id => $definition) { $this->availableToolkits[$id] = $manager->createInstance($id); @@ -50,6 +53,7 @@ public static function create(ContainerInterface $container) { return new static( $container->get('config.factory'), $container->get('config.context.free'), + $container->get('string_translation'), $container->get('image.toolkit.manager') ); } diff --git a/core/modules/system/lib/Drupal/system/Form/ModulesListConfirmForm.php b/core/modules/system/lib/Drupal/system/Form/ModulesListConfirmForm.php index 8296ba6..e62da0e 100644 --- a/core/modules/system/lib/Drupal/system/Form/ModulesListConfirmForm.php +++ b/core/modules/system/lib/Drupal/system/Form/ModulesListConfirmForm.php @@ -36,13 +36,6 @@ class ModulesListConfirmForm extends ConfirmFormBase implements ControllerInterf protected $keyValueExpirable; /** - * The translation manager service. - * - * @var \Drupal\Core\StringTranslation\TranslationManager - */ - protected $translationManager; - - /** * The request object. * * @var \Symfony\Component\HttpFoundation\Request @@ -78,16 +71,17 @@ public static function create(ContainerInterface $container) { * The translation manager. */ public function __construct(ModuleHandlerInterface $module_handler, KeyValueStoreExpirableInterface $key_value_expirable, TranslationManager $translation_manager) { + parent::__construct($translation_manager); + $this->moduleHandler = $module_handler; $this->keyValueExpirable = $key_value_expirable; - $this->translationManager = $translation_manager; } /** * {@inheritdoc} */ public function getQuestion() { - return $this->translationManager->translate('Some required modules must be enabled'); + return $this->t('Some required modules must be enabled'); } /** @@ -101,14 +95,14 @@ public function getCancelPath() { * {@inheritdoc} */ public function getConfirmText() { - return $this->translationManager->translate('Continue'); + return $this->t('Continue'); } /** * {@inheritdoc} */ public function getDescription() { - return $this->translationManager->translate('Would you like to continue with the above?'); + return $this->t('Would you like to continue with the above?'); } /** @@ -181,7 +175,7 @@ public function submitForm(array &$form, array &$form_state) { // message if there are changes. if ($before != $this->moduleHandler->getModuleList()) { drupal_flush_all_caches(); - drupal_set_message($this->translationManager->translate('The configuration options have been saved.')); + drupal_set_message($this->t('The configuration options have been saved.')); } $form_state['redirect'] = $this->getCancelPath(); diff --git a/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php b/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php index c699c09..bc39c37 100644 --- a/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php +++ b/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php @@ -9,10 +9,9 @@ use Drupal\Core\Controller\ControllerInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Form\FormInterface; -use Drupal\Core\KeyValueStore\KeyValueExpirableFactory; +use Drupal\Core\Form\FormBase; use Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface; -use Drupal\Core\StringTranslation\TranslationManager; +use Drupal\Core\Routing\PathBasedGeneratorInterface; use Drupal\Component\Utility\Unicode; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; @@ -25,7 +24,7 @@ * requires. See drupal_parse_info_file() for info on module.info.yml * descriptors. */ -class ModulesListForm implements FormInterface, ControllerInterface { +class ModulesListForm extends FormBase implements ControllerInterface { /** * The module handler service. @@ -42,13 +41,6 @@ class ModulesListForm implements FormInterface, ControllerInterface { protected $keyValueExpirable; /** - * The translation manager service. - * - * @var \Drupal\Core\StringTranslation\TranslationManager - */ - protected $translationManager; - - /** * The request object. * * @var \Symfony\Component\HttpFoundation\Request @@ -61,8 +53,7 @@ class ModulesListForm implements FormInterface, ControllerInterface { public static function create(ContainerInterface $container) { return new static( $container->get('module_handler'), - $container->get('keyvalue.expirable')->get('module_list'), - $container->get('string_translation') + $container->get('keyvalue.expirable')->get('module_list') ); } @@ -73,13 +64,10 @@ public static function create(ContainerInterface $container) { * The module handler. * @param \Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface $key_value_expirable * The key value expirable factory. - * @param \Drupal\Core\StringTranslation\TranslationManager - * The translation manager. */ - public function __construct(ModuleHandlerInterface $module_handler, KeyValueStoreExpirableInterface $key_value_expirable, TranslationManager $translation_manager) { + public function __construct(ModuleHandlerInterface $module_handler, KeyValueStoreExpirableInterface $key_value_expirable) { $this->moduleHandler = $module_handler; $this->keyValueExpirable = $key_value_expirable; - $this->translationManager = $translation_manager; } /** @@ -111,14 +99,14 @@ public function buildForm(array $form, array &$form_state, Request $request = NU $form['filters']['text'] = array( '#type' => 'search', - '#title' => $this->translationManager->translate('Search'), + '#title' => $this->t('Search'), '#size' => 30, - '#placeholder' => $this->translationManager->translate('Enter module name'), + '#placeholder' => $this->t('Enter module name'), '#attributes' => array( 'class' => array('table-filter-text'), 'data-table' => '#system-modules', 'autocomplete' => 'off', - 'title' => $this->translationManager->translate('Enter a part of the module name or description to filter by.'), + 'title' => $this->t('Enter a part of the module name or description to filter by.'), ), ); @@ -139,12 +127,12 @@ public function buildForm(array $form, array &$form_state, Request $request = NU foreach (element_children($form['modules']) as $package) { $form['modules'][$package] += array( '#type' => 'details', - '#title' => $this->translationManager->translate($package), + '#title' => $this->t($package), '#theme' => 'system_modules_details', '#header' => array( - array('data' => '' . $this->translationManager->translate('Enabled') . '', 'class' => array('checkbox')), - array('data' => $this->translationManager->translate('Name'), 'class' => array('name')), - array('data' => $this->translationManager->translate('Description'), 'class' => array('description', RESPONSIVE_PRIORITY_LOW)), + array('data' => '' . $this->t('Enabled') . '', 'class' => array('checkbox')), + array('data' => $this->t('Name'), 'class' => array('name')), + array('data' => $this->t('Description'), 'class' => array('description', RESPONSIVE_PRIORITY_LOW)), ), '#attributes' => array('class' => array('package-listing')), // Ensure that the "Core" package comes first. @@ -159,7 +147,7 @@ public function buildForm(array $form, array &$form_state, Request $request = NU $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', - '#value' => $this->translationManager->translate('Save configuration'), + '#value' => $this->t('Save configuration'), ); return $form; @@ -184,7 +172,7 @@ protected function buildRow(array $modules, $module, $distribution) { $row['#required_by'] = array(); $row['name']['#markup'] = $module->info['name']; - $row['description']['#markup'] = $this->translationManager->translate($module->info['description']); + $row['description']['#markup'] = $this->t($module->info['description']); $row['version']['#markup'] = $module->info['version']; // Add links for each module. @@ -197,9 +185,9 @@ protected function buildRow(array $modules, $module, $distribution) { if ($this->moduleHandler->invoke($module->name, 'help', array("admin/help#$module->name", $help))) { $row['links']['help'] = array( '#type' => 'link', - '#title' => $this->translationManager->translate('Help'), + '#title' => $this->t('Help'), '#href' => "admin/help/$module->name", - '#options' => array('attributes' => array('class' => array('module-link', 'module-link-help'), 'title' => $this->translationManager->translate('Help'))), + '#options' => array('attributes' => array('class' => array('module-link', 'module-link-help'), 'title' => $this->t('Help'))), ); } } @@ -209,9 +197,9 @@ protected function buildRow(array $modules, $module, $distribution) { if ($module->status && user_access('administer permissions') && in_array($module->name, $this->moduleHandler->getImplementations('permission'))) { $row['links']['permissions'] = array( '#type' => 'link', - '#title' => $this->translationManager->translate('Permissions'), + '#title' => $this->t('Permissions'), '#href' => 'admin/people/permissions', - '#options' => array('fragment' => 'module-' . $module->name, 'attributes' => array('class' => array('module-link', 'module-link-permissions'), 'title' => $this->translationManager->translate('Configure permissions'))), + '#options' => array('fragment' => 'module-' . $module->name, 'attributes' => array('class' => array('module-link', 'module-link-permissions'), 'title' => $this->t('Configure permissions'))), ); } @@ -221,7 +209,7 @@ protected function buildRow(array $modules, $module, $distribution) { if (($configure = menu_get_item($module->info['configure'])) && $configure['access']) { $row['links']['configure'] = array( '#type' => 'link', - '#title' => $this->translationManager->translate('Configure'), + '#title' => $this->t('Configure'), '#href' => $configure['href'], '#options' => array('attributes' => array('class' => array('module-link', 'module-link-configure'), 'title' => $configure['description'])), ); @@ -231,7 +219,7 @@ protected function buildRow(array $modules, $module, $distribution) { // Present a checkbox for installing and indicating the status of a module. $row['enable'] = array( '#type' => 'checkbox', - '#title' => $this->translationManager->translate('Enable'), + '#title' => $this->t('Enable'), '#default_value' => (bool) $module->status, ); @@ -249,7 +237,7 @@ protected function buildRow(array $modules, $module, $distribution) { // Check the core compatibility. if ($module->info['core'] != DRUPAL_CORE_COMPATIBILITY) { $compatible = FALSE; - $status .= $this->translationManager->translate('This version is not compatible with Drupal !core_version and should be replaced.', array( + $status .= $this->t('This version is not compatible with Drupal !core_version and should be replaced.', array( '!core_version' => DRUPAL_CORE_COMPATIBILITY, )); } @@ -258,7 +246,7 @@ protected function buildRow(array $modules, $module, $distribution) { if (version_compare(phpversion(), $module->info['php']) < 0) { $compatible = FALSE; $required = $module->info['php'] . (substr_count($module->info['php'], '.') < 2 ? '.*' : ''); - $status .= $this->translationManager->translate('This module requires PHP version @php_required and is incompatible with PHP version !php_version.', array( + $status .= $this->t('This module requires PHP version @php_required and is incompatible with PHP version !php_version.', array( '@php_required' => $required, '!php_version' => phpversion(), )); @@ -276,7 +264,7 @@ protected function buildRow(array $modules, $module, $distribution) { // If this module requires other modules, add them to the array. foreach ($module->requires as $dependency => $version) { if (!isset($modules[$dependency])) { - $row['#requires'][$dependency] = $this->translationManager->translate('@module (missing)', array('@module' => Unicode::ucfirst($dependency))); + $row['#requires'][$dependency] = $this->t('@module (missing)', array('@module' => Unicode::ucfirst($dependency))); $row['enable']['#disabled'] = TRUE; } // Only display visible modules. @@ -285,7 +273,7 @@ protected function buildRow(array $modules, $module, $distribution) { // Disable the module's checkbox if it is incompatible with the // dependency's version. if ($incompatible_version = drupal_check_incompatibility($version, str_replace(DRUPAL_CORE_COMPATIBILITY . '-', '', $modules[$dependency]->info['version']))) { - $row['#requires'][$dependency] = $this->translationManager->translate('@module (incompatible with version @version)', array( + $row['#requires'][$dependency] = $this->t('@module (incompatible with version @version)', array( '@module' => $name . $incompatible_version, '@version' => $modules[$dependency]->info['version'], )); @@ -294,16 +282,16 @@ protected function buildRow(array $modules, $module, $distribution) { // Disable the checkbox if the dependency is incompatible with this // version of Drupal core. elseif ($modules[$dependency]->info['core'] != DRUPAL_CORE_COMPATIBILITY) { - $row['#requires'][$dependency] = $this->translationManager->translate('@module (incompatible with this version of Drupal core)', array( + $row['#requires'][$dependency] = $this->t('@module (incompatible with this version of Drupal core)', array( '@module' => $name, )); $row['enable']['#disabled'] = TRUE; } elseif ($modules[$dependency]->status) { - $row['#requires'][$dependency] = $this->translationManager->translate('@module', array('@module' => $name)); + $row['#requires'][$dependency] = $this->t('@module', array('@module' => $name)); } else { - $row['#requires'][$dependency] = $this->translationManager->translate('@module (disabled)', array('@module' => $name)); + $row['#requires'][$dependency] = $this->t('@module (disabled)', array('@module' => $name)); } } } @@ -313,11 +301,11 @@ protected function buildRow(array $modules, $module, $distribution) { foreach ($module->required_by as $dependent => $version) { if (isset($modules[$dependent]) && empty($modules[$dependent]->info['hidden'])) { if ($modules[$dependent]->status == 1 && $module->status == 1) { - $row['#required_by'][$dependent] = $this->translationManager->translate('@module', array('@module' => $modules[$dependent]->info['name'])); + $row['#required_by'][$dependent] = $this->t('@module', array('@module' => $modules[$dependent]->info['name'])); $row['enable']['#disabled'] = TRUE; } else { - $row['#required_by'][$dependent] = $this->translationManager->translate('@module (disabled)', array('@module' => $modules[$dependent]->info['name'])); + $row['#required_by'][$dependent] = $this->t('@module (disabled)', array('@module' => $modules[$dependent]->info['name'])); } } } @@ -412,12 +400,6 @@ protected function buildModuleList(array $form_state) { /** * {@inheritdoc} */ - public function validateForm(array &$form, array &$form_state) { - } - - /** - * {@inheritdoc} - */ public function submitForm(array &$form, array &$form_state) { // Retrieve a list of modules to enable/disable and their dependencies. $modules = $this->buildModuleList($form_state); diff --git a/core/modules/system/lib/Drupal/system/Form/ModulesUninstallConfirmForm.php b/core/modules/system/lib/Drupal/system/Form/ModulesUninstallConfirmForm.php index 463eb5a..f0a5a4b 100644 --- a/core/modules/system/lib/Drupal/system/Form/ModulesUninstallConfirmForm.php +++ b/core/modules/system/lib/Drupal/system/Form/ModulesUninstallConfirmForm.php @@ -37,13 +37,6 @@ class ModulesUninstallConfirmForm extends ConfirmFormBase implements ControllerI protected $keyValueExpirable; /** - * The translation manager service. - * - * @var \Drupal\Core\StringTranslation\TranslationManager - */ - protected $translationManager; - - /** * The request object. * * @var \Symfony\Component\HttpFoundation\Request @@ -79,23 +72,24 @@ public static function create(ContainerInterface $container) { * The translation manager. */ public function __construct(ModuleHandlerInterface $module_handler, KeyValueStoreExpirableInterface $key_value_expirable, TranslationManager $translation_manager) { + parent::__construct($translation_manager); + $this->moduleHandler = $module_handler; $this->keyValueExpirable = $key_value_expirable; - $this->translationManager = $translation_manager; } /** * {@inheritdoc} */ public function getQuestion() { - return $this->translationManager->translate('Confirm uninstall'); + return $this->t('Confirm uninstall'); } /** * {@inheritdoc} */ public function getConfirmText() { - return $this->translationManager->translate('Uninstall'); + return $this->t('Uninstall'); } /** @@ -109,7 +103,7 @@ public function getCancelPath() { * {@inheritdoc} */ public function getDescription() { - return $this->translationManager->translate('Would you like to continue with uninstalling the above?'); + return $this->t('Would you like to continue with uninstalling the above?'); } /** @@ -136,7 +130,7 @@ public function buildForm(array $form, array &$form_state, Request $request = NU } $data = system_rebuild_module_data(); - $form['text']['#markup'] = '

' . $this->translationManager->translate('The following modules will be completely uninstalled from your site, and all data from these modules will be lost!') . '

'; + $form['text']['#markup'] = '

' . $this->t('The following modules will be completely uninstalled from your site, and all data from these modules will be lost!') . '

'; $form['modules'] = array( '#theme' => 'item_list', '#items' => array_map(function ($module) use ($data) { @@ -158,7 +152,7 @@ public function submitForm(array &$form, array &$form_state) { // Uninstall the modules. $this->moduleHandler->uninstall($this->modules); - drupal_set_message($this->translationManager->translate('The selected modules have been uninstalled.')); + drupal_set_message($this->t('The selected modules have been uninstalled.')); $form_state['redirect'] = 'admin/modules/uninstall'; } diff --git a/core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php b/core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php index a6b3dea..cb49c8e 100644 --- a/core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php +++ b/core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php @@ -7,19 +7,18 @@ namespace Drupal\system\Form; -use Drupal\Core\Form\FormInterface; -use Drupal\Core\StringTranslation\TranslationManager; -use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\Core\Controller\ControllerInterface; -use Drupal\Core\KeyValueStore\KeyValueExpirableFactory; -use Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface; use Drupal\Core\Extension\ModuleHandlerInterface; +use Drupal\Core\Form\FormBase; +use Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface; +use Drupal\Core\StringTranslation\TranslationManager; +use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; /** * Provides a form for uninstalling modules. */ -class ModulesUninstallForm implements FormInterface, ControllerInterface { +class ModulesUninstallForm extends FormBase implements ControllerInterface { /** * The module handler service. @@ -36,13 +35,6 @@ class ModulesUninstallForm implements FormInterface, ControllerInterface { protected $keyValueExpirable; /** - * The translation manager service. - * - * @var \Drupal\Core\StringTranslation\TranslationManager - */ - protected $translationManager; - - /** * The request object. * * @var \Symfony\Component\HttpFoundation\Request @@ -55,8 +47,7 @@ class ModulesUninstallForm implements FormInterface, ControllerInterface { public static function create(ContainerInterface $container) { return new static( $container->get('module_handler'), - $container->get('keyvalue.expirable')->get('modules_uninstall'), - $container->get('string_translation') + $container->get('keyvalue.expirable')->get('modules_uninstall') ); } @@ -67,13 +58,10 @@ public static function create(ContainerInterface $container) { * The module handler. * @param \Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface $key_value_expirable * The key value expirable factory. - * @param \Drupal\Core\StringTranslation\TranslationManager $translation_manager - * The translation manager. */ - public function __construct(ModuleHandlerInterface $module_handler, KeyValueStoreExpirableInterface $key_value_expirable, TranslationManager $translation_manager) { + public function __construct(ModuleHandlerInterface $module_handler, KeyValueStoreExpirableInterface $key_value_expirable) { $this->moduleHandler = $module_handler; $this->keyValueExpirable = $key_value_expirable; - $this->translationManager = $translation_manager; } /** @@ -118,11 +106,11 @@ public function buildForm(array $form, array &$form_state, Request $request = NU $name = $module->info['name'] ?: $module->name; $form['modules'][$module->name]['#module_name'] = $name; $form['modules'][$module->name]['name']['#markup'] = $name; - $form['modules'][$module->name]['description']['#markup'] = $this->translationManager->translate($module->info['description']); + $form['modules'][$module->name]['description']['#markup'] = $this->t($module->info['description']); $form['uninstall'][$module->name] = array( '#type' => 'checkbox', - '#title' => $this->translationManager->translate('Uninstall @module module', array('@module' => $name)), + '#title' => $this->t('Uninstall @module module', array('@module' => $name)), '#title_display' => 'invisible', ); @@ -141,7 +129,7 @@ public function buildForm(array $form, array &$form_state, Request $request = NU $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', - '#value' => $this->translationManager->translate('Uninstall'), + '#value' => $this->t('Uninstall'), ); return $form; @@ -153,7 +141,7 @@ public function buildForm(array $form, array &$form_state, Request $request = NU public function validateForm(array &$form, array &$form_state) { // Form submitted, but no modules selected. if (!array_filter($form_state['values']['uninstall'])) { - drupal_set_message($this->translationManager->translate('No modules selected.'), 'error'); + drupal_set_message($this->t('No modules selected.'), 'error'); $form_state['redirect'] = 'admin/modules/uninstall'; } } diff --git a/core/modules/system/lib/Drupal/system/Form/PerformanceForm.php b/core/modules/system/lib/Drupal/system/Form/PerformanceForm.php index 92404b7..3b555be 100644 --- a/core/modules/system/lib/Drupal/system/Form/PerformanceForm.php +++ b/core/modules/system/lib/Drupal/system/Form/PerformanceForm.php @@ -7,6 +7,7 @@ namespace Drupal\system\Form; +use Drupal\Core\StringTranslation\Translator\TranslatorInterface; use Drupal\system\SystemConfigFormBase; use Drupal\Core\Config\ConfigFactory; use Drupal\Core\Config\Context\ContextInterface; @@ -32,10 +33,12 @@ class PerformanceForm extends SystemConfigFormBase { * The factory for configuration objects. * @param \Drupal\Core\Config\Context\ContextInterface $context * The configuration context used for this configuration object. + * @param \Drupal\Core\StringTranslation\Translator\TranslatorInterface $translation_manager + * The translation manager. * @param \Drupal\Core\Cache\CacheBackendInterface $page_cache */ - public function __construct(ConfigFactory $config_factory, ContextInterface $context, CacheBackendInterface $page_cache) { - parent::__construct($config_factory, $context); + public function __construct(ConfigFactory $config_factory, ContextInterface $context, TranslatorInterface $translation_manager, CacheBackendInterface $page_cache) { + parent::__construct($config_factory, $context, $translation_manager); $this->pageCache = $page_cache; } @@ -47,6 +50,7 @@ public static function create(ContainerInterface $container) { return new static( $container->get('config.factory'), $container->get('config.context.free'), + $container->get('string_translation'), $container->get('cache.page') ); } diff --git a/core/modules/system/lib/Drupal/system/Form/RegionalForm.php b/core/modules/system/lib/Drupal/system/Form/RegionalForm.php index 5bb5b2b..a71b754 100644 --- a/core/modules/system/lib/Drupal/system/Form/RegionalForm.php +++ b/core/modules/system/lib/Drupal/system/Form/RegionalForm.php @@ -10,6 +10,7 @@ use Drupal\Core\Config\ConfigFactory; use Drupal\Core\Config\Context\ContextInterface; use Drupal\Core\Locale\CountryManagerInterface; +use Drupal\Core\StringTranslation\Translator\TranslatorInterface; use Drupal\system\SystemConfigFormBase; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -32,11 +33,13 @@ class RegionalForm extends SystemConfigFormBase { * The factory for configuration objects. * @param \Drupal\Core\Config\Context\ContextInterface $context * The configuration context used for this configuration object. + * @param \Drupal\Core\StringTranslation\Translator\TranslatorInterface $translation_manager + * The translation manager. * @param \Drupal\Core\Locale\CountryManagerInterface $country_manager * The country manager. */ - public function __construct(ConfigFactory $config_factory, ContextInterface $context, CountryManagerInterface $country_manager) { - parent::__construct($config_factory, $context); + public function __construct(ConfigFactory $config_factory, ContextInterface $context, TranslatorInterface $translation_manager, CountryManagerInterface $country_manager) { + parent::__construct($config_factory, $context, $translation_manager); $this->countryManager = $country_manager; } @@ -47,6 +50,7 @@ public static function create(ContainerInterface $container) { return new static( $container->get('config.factory'), $container->get('config.context.free'), + $container->get('string_translation'), $container->get('country_manager') ); } diff --git a/core/modules/system/lib/Drupal/system/Form/SiteInformationForm.php b/core/modules/system/lib/Drupal/system/Form/SiteInformationForm.php index 55b1175..b3daf4c 100644 --- a/core/modules/system/lib/Drupal/system/Form/SiteInformationForm.php +++ b/core/modules/system/lib/Drupal/system/Form/SiteInformationForm.php @@ -10,6 +10,7 @@ use Drupal\Core\Config\ConfigFactory; use Drupal\Core\Config\Context\ContextInterface; use Drupal\Core\Path\AliasManagerInterface; +use Drupal\Core\StringTranslation\Translator\TranslatorInterface; use Drupal\system\SystemConfigFormBase; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -32,11 +33,13 @@ class SiteInformationForm extends SystemConfigFormBase { * The factory for configuration objects. * @param \Drupal\Core\Config\Context\ContextInterface $context * The configuration context used for this configuration object. + * @param \Drupal\Core\StringTranslation\Translator\TranslatorInterface $translation_manager + * The translation manager. * @param \Drupal\Core\Path\AliasManagerInterface $alias_manager * The path alias manager. */ - public function __construct(ConfigFactory $config_factory, ContextInterface $context, AliasManagerInterface $alias_manager) { - parent::__construct($config_factory, $context); + public function __construct(ConfigFactory $config_factory, ContextInterface $context, TranslatorInterface $translation_manager, AliasManagerInterface $alias_manager) { + parent::__construct($config_factory, $context, $translation_manager); $this->aliasManager = $alias_manager; } @@ -48,6 +51,7 @@ public static function create(ContainerInterface $container) { return new static( $container->get('config.factory'), $container->get('config.context.free'), + $container->get('string_translation'), $container->get('path.alias_manager') ); } diff --git a/core/modules/system/lib/Drupal/system/Form/ThemeSettingsForm.php b/core/modules/system/lib/Drupal/system/Form/ThemeSettingsForm.php index 216d0d1..04ee621 100644 --- a/core/modules/system/lib/Drupal/system/Form/ThemeSettingsForm.php +++ b/core/modules/system/lib/Drupal/system/Form/ThemeSettingsForm.php @@ -7,6 +7,7 @@ namespace Drupal\system\Form; +use Drupal\Core\StringTranslation\Translator\TranslatorInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Drupal\Core\Cache\Cache; @@ -34,11 +35,13 @@ class ThemeSettingsForm extends SystemConfigFormBase { * The factory for configuration objects. * @param \Drupal\Core\Config\Context\ContextInterface $context * The configuration context to use. - * @param Drupal\Core\Extension\ModuleHandlerInterface + * @param \Drupal\Core\StringTranslation\Translator\TranslatorInterface $translation_manager + * The translation manager. + * @param \Drupal\Core\Extension\ModuleHandlerInterface * The module handler instance to use. */ - public function __construct(ConfigFactory $config_factory, ContextInterface $context, ModuleHandlerInterface $module_handler) { - parent::__construct($config_factory, $context); + public function __construct(ConfigFactory $config_factory, ContextInterface $context, TranslatorInterface $translation_manager, ModuleHandlerInterface $module_handler) { + parent::__construct($config_factory, $context, $translation_manager); $this->moduleHandler = $module_handler; } @@ -50,6 +53,7 @@ public static function create(ContainerInterface $container) { return new static( $container->get('config.factory'), $container->get('config.context.free'), + $container->get('string_translation'), $container->get('module_handler') ); } diff --git a/core/modules/system/lib/Drupal/system/SystemConfigFormBase.php b/core/modules/system/lib/Drupal/system/SystemConfigFormBase.php index eb82bdc..da7a32c 100644 --- a/core/modules/system/lib/Drupal/system/SystemConfigFormBase.php +++ b/core/modules/system/lib/Drupal/system/SystemConfigFormBase.php @@ -7,7 +7,7 @@ namespace Drupal\system; -use Drupal\Core\Form\FormInterface; +use Drupal\Core\Form\FormBase; use Drupal\Core\Controller\ControllerInterface; use Drupal\Core\Config\ConfigFactory; use Drupal\Core\Config\Context\ContextInterface; @@ -16,7 +16,7 @@ /** * Base class for implementing system configuration forms. */ -abstract class SystemConfigFormBase implements FormInterface, ControllerInterface { +abstract class SystemConfigFormBase extends FormBase implements ControllerInterface { /** * Stores the configuration factory. @@ -55,7 +55,7 @@ public function buildForm(array $form, array &$form_state) { $form['actions']['#type'] = 'actions'; $form['actions']['submit'] = array( '#type' => 'submit', - '#value' => t('Save configuration'), + '#value' => $this->t('Save configuration'), '#button_type' => 'primary', ); @@ -66,16 +66,10 @@ public function buildForm(array $form, array &$form_state) { } /** - * Implements \Drupal\Core\Form\FormInterface::validateForm(). - */ - public function validateForm(array &$form, array &$form_state) { - } - - /** * Implements \Drupal\Core\Form\FormInterface::submitForm(). */ public function submitForm(array &$form, array &$form_state) { - drupal_set_message(t('The configuration options have been saved.')); + drupal_set_message($this->t('The configuration options have been saved.')); } } diff --git a/core/modules/user/lib/Drupal/user/AccountSettingsForm.php b/core/modules/user/lib/Drupal/user/AccountSettingsForm.php index c43dc6d..d4ccb94 100644 --- a/core/modules/user/lib/Drupal/user/AccountSettingsForm.php +++ b/core/modules/user/lib/Drupal/user/AccountSettingsForm.php @@ -7,6 +7,7 @@ namespace Drupal\user; +use Drupal\Core\StringTranslation\Translator\TranslatorInterface; use Drupal\system\SystemConfigFormBase; use Drupal\Core\Config\ConfigFactory; use Drupal\Core\Config\Context\ContextInterface; @@ -32,11 +33,13 @@ class AccountSettingsForm extends SystemConfigFormBase { * The factory for configuration objects. * @param \Drupal\Core\Config\Context\ContextInterface $context * The configuration context. + * @param \Drupal\Core\StringTranslation\Translator\TranslatorInterface $translation_manager + * The translation manager. * @param \Drupal\Core\Extension\ModuleHandler $module_handler * The module handler. */ - public function __construct(ConfigFactory $config_factory, ContextInterface $context, ModuleHandler $module_handler) { - parent::__construct($config_factory, $context); + public function __construct(ConfigFactory $config_factory, ContextInterface $context, TranslatorInterface $translation_manager, ModuleHandler $module_handler) { + parent::__construct($config_factory, $context, $translation_manager); $this->moduleHandler = $module_handler; } @@ -47,6 +50,7 @@ public static function create(ContainerInterface $container) { return new static( $container->get('config.factory'), $container->get('config.context.free'), + $container->get('string_translation'), $container->get('module_handler') ); }