Verified Commit a4c98c94 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3181778 by quietone, longwave, aldairsoares, beatrizrodrigues, Aline...

Issue #3181778 by quietone, longwave, aldairsoares, beatrizrodrigues, Aline Teixeira Ramos, KapilV, raman.b, anushrikumari, CChiste, mallezie, Ratan Priya, rakesh.regar, Kevin.Notari, vicheldt, mauryarahul11, yogeshmpawar, bbrala, alexpott, bruno.bicudo: [w/c September 17th] Replace t() with $this->t() in all plugins

(cherry picked from commit 6bbfb055)
parent efeb6f0e
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -163,25 +163,25 @@ public function defaultConfiguration() {
  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
    $form['recipient'] = [
      '#type' => 'textfield',
      '#title' => t('Recipient email address'),
      '#title' => $this->t('Recipient email address'),
      '#default_value' => $this->configuration['recipient'],
      '#maxlength' => '254',
      '#description' => t('You may also use tokens: [node:author:mail], [comment:author:mail], etc. Separate recipients with a comma.'),
      '#description' => $this->t('You may also use tokens: [node:author:mail], [comment:author:mail], etc. Separate recipients with a comma.'),
    ];
    $form['subject'] = [
      '#type' => 'textfield',
      '#title' => t('Subject'),
      '#title' => $this->t('Subject'),
      '#default_value' => $this->configuration['subject'],
      '#maxlength' => '254',
      '#description' => t('The subject of the message.'),
      '#description' => $this->t('The subject of the message.'),
    ];
    $form['message'] = [
      '#type' => 'textarea',
      '#title' => t('Message'),
      '#title' => $this->t('Message'),
      '#default_value' => $this->configuration['message'],
      '#cols' => '80',
      '#rows' => '20',
      '#description' => t('The message that should be sent. You may include placeholders like [node:title], [user:account-name], [user:display-name] and [comment:body] to represent data that will be different each time message is sent. Not all placeholders will be available in all contexts.'),
      '#description' => $this->t('The message that should be sent. You may include placeholders like [node:title], [user:account-name], [user:display-name] and [comment:body] to represent data that will be different each time message is sent. Not all placeholders will be available in all contexts.'),
    ];
    return $form;
  }
@@ -192,7 +192,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
  public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
    if (!$this->emailValidator->isValid($form_state->getValue('recipient')) && strpos($form_state->getValue('recipient'), ':mail') === FALSE) {
      // We want the literal %author placeholder to be emphasized in the error message.
      $form_state->setErrorByName('recipient', t('Enter a valid email address or use a token email address such as %author.', ['%author' => '[node:author:mail]']));
      $form_state->setErrorByName('recipient', $this->t('Enter a valid email address or use a token email address such as %author.', ['%author' => '[node:author:mail]']));
    }
  }

+2 −2
Original line number Diff line number Diff line
@@ -114,8 +114,8 @@ public function defaultConfiguration() {
  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
    $form['url'] = [
      '#type' => 'textfield',
      '#title' => t('URL'),
      '#description' => t('The URL to which the user should be redirected. This can be an internal URL like /node/1234 or an external URL like @url.', ['@url' => 'http://example.com']),
      '#title' => $this->t('URL'),
      '#description' => $this->t('The URL to which the user should be redirected. This can be an internal URL like /node/1234 or an external URL like @url.', ['@url' => 'http://example.com']),
      '#default_value' => $this->configuration['url'],
      '#required' => TRUE,
    ];
+2 −2
Original line number Diff line number Diff line
@@ -106,11 +106,11 @@ public function defaultConfiguration() {
  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
    $form['message'] = [
      '#type' => 'textarea',
      '#title' => t('Message'),
      '#title' => $this->t('Message'),
      '#default_value' => $this->configuration['message'],
      '#required' => TRUE,
      '#rows' => '8',
      '#description' => t('The message to be displayed to the current user. You may include placeholders like [node:title], [user:account-name], [user:display-name] and [comment:body] to represent data that will be different each time message is sent. Not all placeholders will be available in all contexts.'),
      '#description' => $this->t('The message to be displayed to the current user. You may include placeholders like [node:title], [user:account-name], [user:display-name] and [comment:body] to represent data that will be different each time message is sent. Not all placeholders will be available in all contexts.'),
    ];
    return $form;
  }
+3 −1
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
use Drupal\Component\Plugin\Derivative\DeriverBase;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
@@ -17,6 +18,7 @@
 * @see plugin_api
 */
class DefaultSelectionDeriver extends DeriverBase implements ContainerDeriverInterface {
  use StringTranslationTrait;

  /**
   * The entity type manager.
@@ -51,7 +53,7 @@ public function getDerivativeDefinitions($base_plugin_definition) {
    foreach ($this->entityTypeManager->getDefinitions() as $entity_type_id => $entity_type) {
      $this->derivatives[$entity_type_id] = $base_plugin_definition;
      $this->derivatives[$entity_type_id]['entity_types'] = [$entity_type_id];
      $this->derivatives[$entity_type_id]['label'] = t('@entity_type selection', ['@entity_type' => $entity_type->getLabel()]);
      $this->derivatives[$entity_type_id]['label'] = $this->t('@entity_type selection', ['@entity_type' => $entity_type->getLabel()]);
      $this->derivatives[$entity_type_id]['base_plugin_label'] = (string) $base_plugin_definition['label'];

      // If the entity type doesn't provide a 'label' key in its plugin
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ class Broken extends SelectionPluginBase {
  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
    $form = parent::buildConfigurationForm($form, $form_state);
    $form['selection_handler'] = [
      '#markup' => t('The selected selection handler is broken.'),
      '#markup' => $this->t('The selected selection handler is broken.'),
    ];
    return $form;
  }
Loading