Commit b1932fc1 authored by Stephen Lucero's avatar Stephen Lucero Committed by Stephen Lucero
Browse files

Issue #3299960 by anoopsingh92, lucassc, slucero, akshaydalvi212, alanmoreira,...

Issue #3299960 by anoopsingh92, lucassc, slucero, akshaydalvi212, alanmoreira, Munavijayalakshmi, JatinGupta40, tauanygb: $this->t() should be used instead of t()
parent 7525cdc7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -27,8 +27,8 @@ class MediaLibrarySettingsForm extends ConfigFormBase {

    $form['use_styles'] = [
      '#type' => 'checkbox',
      '#title' => t('Use bundled styles for the media library modal window'),
      '#description' => t('If checked, then Patternkit will load some styles for
      '#title' => $this->t('Use bundled styles for the media library modal window'),
      '#description' => $this->t('If checked, then Patternkit will load some styles for
        the media library modal window. <br />This feature relies on templates
        provided by <a href="https://www.drupal.org/project/media_library_theme_reset">
        Media Library Theme Reset</a>, so enable that module if you want to use
+5 −2
Original line number Diff line number Diff line
@@ -15,12 +15,15 @@ use Drupal\patternkit\Entity\Pattern;
use Drupal\patternkit\Entity\PatternInterface;
use Drupal\patternkit\PatternEditorConfig;
use Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator;
use Drupal\Core\StringTranslation\StringTranslationTrait;

/**
 * Base functionality for a pattern library parser.
 */
abstract class PatternLibraryParserBase extends LibraryDiscoveryParser implements PatternLibraryParserInterface {

  use StringTranslationTrait;

  /**
   * Serializes and de-serializes data.
   *
@@ -328,7 +331,7 @@ abstract class PatternLibraryParserBase extends LibraryDiscoveryParser implement
    $dir = "public://patternkit/$subtype/{$config->instance_id}";
    if (!\Drupal::service('file_system')->prepareDirectory($dir, FileSystem::CREATE_DIRECTORY)) {
      \Drupal::service('messenger')->addMessage(
        t(
        $this->t(
          'Unable to create folder or save metadata/assets for plugin @plugin',
          ['@plugin' => $subtype]
        ));
@@ -357,7 +360,7 @@ abstract class PatternLibraryParserBase extends LibraryDiscoveryParser implement

    if ($save_result === FALSE) {
      \Drupal::service('messenger')->addMessage(
        t(
        $this->t(
          'Unable to save metadata/assets for plugin @plugin',
          ['@plugin' => $subtype]
        ));
+1 −1
Original line number Diff line number Diff line
@@ -408,7 +408,7 @@ class PatternkitCommands extends DrushCommands {
    if ($base_pattern->getHash() === $pattern->getHash()) {
      return FALSE;
    }
    $logger->notice(t('Updating pattern from @old to @new.',
    $logger->notice($this->t('Updating pattern from @old to @new.',
      ['@old' => $pattern->getVersion(), '@new' => $base_pattern->getVersion()]));
    $pattern->setNewRevision();
    $pattern->isDefaultRevision(TRUE);
+1 −1
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@ class Pattern extends RenderElement implements ContainerFactoryPluginInterface {
    // Fail early if a pattern was unable to be loaded.
    if (is_null($pattern)) {
      return [
        '#markup' => t('Pattern unavailable.'),
        '#markup' => $this->t('Pattern unavailable.'),
      ];
    }

+14 −14
Original line number Diff line number Diff line
@@ -120,7 +120,7 @@ class PatternLibraryJSONForm extends ConfigFormBase {
    $themes = array_keys(static::THEMES);
    $form['patternkit_json_editor_theme'] = [
      '#type' => 'select',
      '#title' => t('Select the JSON Editor Theme'),
      '#title' => $this->t('Select the JSON Editor Theme'),
      '#options' => array_combine($themes, $themes),
      '#default_value' => $config->get('patternkit_json_editor_theme'),
    ];
@@ -128,29 +128,29 @@ class PatternLibraryJSONForm extends ConfigFormBase {
    $icons = array_keys(static::ICONS);
    $form['patternkit_json_editor_icons'] = [
      '#type' => 'select',
      '#title' => t('Select the icons to be used with the editor'),
      '#title' => $this->t('Select the icons to be used with the editor'),
      '#options' => array_combine($icons, $icons),
      '#default_value' => $config->get('patternkit_json_editor_icons'),
    ];

    $form['patternkit_json_editor_css'] = [
      '#type' => 'textfield',
      '#title' => t('Add to the editor theme CSS'),
      '#description' => t('Enter a comma-separated list of additional CSS to include.'),
      '#title' => $this->t('Add to the editor theme CSS'),
      '#description' => $this->t('Enter a comma-separated list of additional CSS to include.'),
      '#default_value' => $config->get('patternkit_json_editor_css'),
    ];

    $form['patternkit_json_editor_js'] = [
      '#type' => 'textfield',
      '#title' => t('Add to the editor theme JS'),
      '#description' => t('Enter a comma-separated list of additional JS to include.'),
      '#title' => $this->t('Add to the editor theme JS'),
      '#description' => $this->t('Enter a comma-separated list of additional JS to include.'),
      '#default_value' => $config->get('patternkit_json_editor_js'),
    ];

    $form['patternkit_json_editor_use_shadow_dom'] = [
      '#type' => 'checkbox',
      '#title' => t('Use the Shadow DOM'),
      '#description' => t('Select whether to use the Shadow DOM for the JSON
      '#title' => $this->t('Use the Shadow DOM'),
      '#description' => $this->t('Select whether to use the Shadow DOM for the JSON
      Editor form. Most themes require the Shadow DOM, but most WYSIWYG editors
      do not work with it.'),
      '#default_value' => $config->get('patternkit_json_editor_use_shadow_dom') ?? TRUE,
@@ -158,21 +158,21 @@ class PatternLibraryJSONForm extends ConfigFormBase {

    $form['patternkit_json_editor_disable_properties_buttons'] = [
      '#type' => 'checkbox',
      '#title' => t('Hide the properties buttons'),
      '#description' => t('Select whether to hide the property buttons (maps to json-editor option <em>disable_properties</em>).'),
      '#title' => $this->t('Hide the properties buttons'),
      '#description' => $this->t('Select whether to hide the property buttons (maps to json-editor option <em>disable_properties</em>).'),
      '#default_value' => $config->get('patternkit_json_editor_disable_properties_buttons') ?? FALSE,
    ];

    $form['patternkit_json_editor_disable_edit_json_button'] = [
      '#type' => 'checkbox',
      '#title' => t('Hide the JSON Edit button'),
      '#description' => t('Select whether to show the Edit JSON button (maps to json-editor option <em>disable_edit_json</em>).'),
      '#title' => $this->t('Hide the JSON Edit button'),
      '#description' => $this->t('Select whether to show the Edit JSON button (maps to json-editor option <em>disable_edit_json</em>).'),
      '#default_value' => $config->get('patternkit_json_editor_disable_edit_json_button') ?? TRUE,
    ];

    $form['patternkit_json_editor_wysiwyg'] = [
      '#type' => 'select',
      '#title' => t('WYSIWYG editor'),
      '#title' => $this->t('WYSIWYG editor'),
      '#options' => static::EDITORS,
      '#empty_value' => '',
      '#default_value' => $config->get('patternkit_json_editor_wysiwyg') ?: '',
@@ -188,7 +188,7 @@ class PatternLibraryJSONForm extends ConfigFormBase {

    $form['patternkit_json_editor_ckeditor_toolbar'] = [
      '#type' => 'select',
      '#title' => t('CKEditor toolbar'),
      '#title' => $this->t('CKEditor toolbar'),
      '#options' => $ckeditor_toolbar_options,
      '#empty_value' => '',
      '#default_value' => $config->get('patternkit_json_editor_ckeditor_toolbar') ?: '',
Loading