Commit b91dc689 authored by renatog's avatar renatog Committed by renatog
Browse files

Issue #3270598 by RenatoG: Create a generic settings with the default case to...

Issue #3270598 by RenatoG: Create a generic settings with the default case to be used for class and attributes settings
parent 08bf709e
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -22,14 +22,14 @@

          if (default_case == 'uppercase') {

            $('#edit-third-party-settings-block-class-classes, .block-class-bulk-operations-insert-classes_to_be_added, .block-class-bulk-operations-update-class-new-class').keyup(function() {
            $('.block-class-class, .block-class-attributes, .block-class-bulk-operations-insert-classes_to_be_added, .block-class-bulk-operations-update-class-new-class').keyup(function() {
              $(this).val($(this).val().toUpperCase());
            });

          }
          else {

            $('#edit-third-party-settings-block-class-classes, .block-class-bulk-operations-insert-classes_to_be_added, .block-class-bulk-operations-update-class-new-class').keyup(function() {
            $('.block-class-class, .block-class-attributes, .block-class-bulk-operations-insert-classes_to_be_added, .block-class-bulk-operations-update-class-new-class').keyup(function() {
              $(this).val($(this).val().toLowerCase());
            });

+17 −11
Original line number Diff line number Diff line
@@ -91,27 +91,27 @@ class BlockClassSettingsForm extends ConfigFormBase {

    $config = $this->config('block_class.settings');

    // Default value.
    $default_case = 'standard';

    // Verify if there is a value in the database.
    if (!empty($config->get('default_case'))) {
      $default_case = $config->get('default_case');
    }

    $form['global_settings'] = [
      '#type' => 'details',
      '#title' => $this->t('Global Settings'),
      '#open' => TRUE,
    ];

    $form['global_settings']['class'] = [
    $form['global_settings']['general'] = [
      '#type' => 'details',
      '#title' => $this->t('Class'),
      '#title' => $this->t('General'),
      '#open' => TRUE,
    ];

    // Default value.
    $default_case = 'standard';

    // Verify if there is a value in the database.
    if (!empty($config->get('default_case'))) {
      $default_case = $config->get('default_case');
    }

    $form['global_settings']['class']['default_case'] = [
    $form['global_settings']['general']['default_case'] = [
      '#title' => $this->t("Default Case"),
      '#type' => 'select',
      '#description' => $this->t('If you select "Uppercase and Lowercase" but cases will be accepted. If you select "Uppercase" all classes will be added using uppercase and if you select "Lowercase" all classes added will be added using lowercase.'),
@@ -123,6 +123,12 @@ class BlockClassSettingsForm extends ConfigFormBase {
      '#default_value' => $default_case,
    ];

    $form['global_settings']['class'] = [
      '#type' => 'details',
      '#title' => $this->t('Class'),
      '#open' => TRUE,
    ];

    $field_type = 'textfield';

    if (!empty($config->get('field_type'))) {
+4 −0
Original line number Diff line number Diff line
@@ -373,6 +373,8 @@ class BlockClassHelperService {
        '#maxlength' => $maxlength_block_class_field,
      ];

      $form['third_party_settings']['block_class']['classes']['#attributes']['class'][] = 'block-class-class';

      if (!empty($config->get('enable_attributes'))) {

        // Default field type.
@@ -390,6 +392,8 @@ class BlockClassHelperService {
          '#default_value' => $block->getThirdPartySetting('block_class', 'attributes'),
        ];

        $form['third_party_settings']['block_class']['attributes']['#attributes']['class'][] = 'block-class-attributes';

        // Get maxlength if exists.
        if (!empty($config->get('maxlength_attributes'))) {
          $form['third_party_settings']['block_class']['attributes']['#maxlength'] = $config->get('maxlength_attributes');