Commit 0b1816c9 authored by catch's avatar catch
Browse files

Issue #3122912 by shaktik, siddhant.bhosale, S_Bhandari, martin107,...

Issue #3122912 by shaktik, siddhant.bhosale, S_Bhandari, martin107, swatichouhan012, kapilkumar0324, raman.b, paulocs, longwave, quietone, xjm: t() calls should be avoided , use $this->t() instead in Form Builders
parent 46345064
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -155,7 +155,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
    // successfully.)
    $post_params = $this->getRequest()->request->all();
    if (empty($post_params) && (Settings::get('skip_permissions_hardening') || !drupal_verify_install_file($this->root . '/' . $settings_file, FILE_EXIST | FILE_READABLE | FILE_NOT_WRITABLE) || !drupal_verify_install_file($this->root . '/' . $settings_dir, FILE_NOT_WRITABLE, 'dir'))) {
      $this->messenger()->addWarning(t('All necessary changes to %dir and %file have been made, so you should remove write permissions to them now in order to avoid security risks. If you are unsure how to do so, consult the <a href=":handbook_url">online handbook</a>.', ['%dir' => $settings_dir, '%file' => $settings_file, ':handbook_url' => 'https://www.drupal.org/server-permissions']));
      $this->messenger()->addWarning($this->t('All necessary changes to %dir and %file have been made, so you should remove write permissions to them now in order to avoid security risks. If you are unsure how to do so, consult the <a href=":handbook_url">online handbook</a>.', ['%dir' => $settings_dir, '%file' => $settings_file, ':handbook_url' => 'https://www.drupal.org/server-permissions']));
    }

    $form['#attached']['library'][] = 'system/drupal.system';
+1 −1
Original line number Diff line number Diff line
@@ -122,7 +122,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta

    $form['expanded'] = [
      '#type' => 'checkbox',
      '#title' => t('Show as expanded'),
      '#title' => $this->t('Show as expanded'),
      '#description' => $this->t('If selected and this menu link has children, the menu will always appear expanded. This option may be overridden for the entire menu tree when placing a menu block.'),
      '#default_value' => $this->menuLink->isExpanded(),
    ];
+1 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ class BlockContentListBuilder extends EntityListBuilder {
   * {@inheritdoc}
   */
  public function buildHeader() {
    $header['label'] = t('Block description');
    $header['label'] = $this->t('Block description');
    return $header + parent::buildHeader();
  }

+1 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ class BlockContentTranslationHandler extends ContentTranslationHandler {
   */
  protected function entityFormTitle(EntityInterface $entity) {
    $block_type = BlockContentType::load($entity->bundle());
    return t('<em>Edit @type</em> @title', ['@type' => $block_type->label(), '@title' => $entity->label()]);
    return $this->t('<em>Edit @type</em> @title', ['@type' => $block_type->label(), '@title' => $entity->label()]);
  }

}
+10 −10
Original line number Diff line number Diff line
@@ -32,10 +32,10 @@ public function form(array $form, FormStateInterface $form_state) {

    $form['label'] = [
      '#type' => 'textfield',
      '#title' => t('Label'),
      '#title' => $this->t('Label'),
      '#maxlength' => 255,
      '#default_value' => $block_type->label(),
      '#description' => t("Provide a label for this block type to help identify it in the administration pages."),
      '#description' => $this->t("Provide a label for this block type to help identify it in the administration pages."),
      '#required' => TRUE,
    ];
    $form['id'] = [
@@ -50,21 +50,21 @@ public function form(array $form, FormStateInterface $form_state) {
    $form['description'] = [
      '#type' => 'textarea',
      '#default_value' => $block_type->getDescription(),
      '#description' => t('Enter a description for this block type.'),
      '#title' => t('Description'),
      '#description' => $this->t('Enter a description for this block type.'),
      '#title' => $this->t('Description'),
    ];

    $form['revision'] = [
      '#type' => 'checkbox',
      '#title' => t('Create new revision'),
      '#title' => $this->t('Create new revision'),
      '#default_value' => $block_type->shouldCreateNewRevision(),
      '#description' => t('Create a new revision by default for this block type.'),
      '#description' => $this->t('Create a new revision by default for this block type.'),
    ];

    if ($this->moduleHandler->moduleExists('language')) {
      $form['language'] = [
        '#type' => 'details',
        '#title' => t('Language settings'),
        '#title' => $this->t('Language settings'),
        '#group' => 'additional_settings',
      ];

@@ -84,7 +84,7 @@ public function form(array $form, FormStateInterface $form_state) {
    $form['actions'] = ['#type' => 'actions'];
    $form['actions']['submit'] = [
      '#type' => 'submit',
      '#value' => t('Save'),
      '#value' => $this->t('Save'),
    ];

    return $this->protectBundleIdElement($form);
@@ -100,12 +100,12 @@ public function save(array $form, FormStateInterface $form_state) {
    $edit_link = $this->entity->toLink($this->t('Edit'), 'edit-form')->toString();
    $logger = $this->logger('block_content');
    if ($status == SAVED_UPDATED) {
      $this->messenger()->addStatus(t('Custom block type %label has been updated.', ['%label' => $block_type->label()]));
      $this->messenger()->addStatus($this->t('Custom block type %label has been updated.', ['%label' => $block_type->label()]));
      $logger->notice('Custom block type %label has been updated.', ['%label' => $block_type->label(), 'link' => $edit_link]);
    }
    else {
      block_content_add_body_field($block_type->id());
      $this->messenger()->addStatus(t('Custom block type %label has been added.', ['%label' => $block_type->label()]));
      $this->messenger()->addStatus($this->t('Custom block type %label has been added.', ['%label' => $block_type->label()]));
      $logger->notice('Custom block type %label has been added.', ['%label' => $block_type->label(), 'link' => $edit_link]);
    }

Loading