Commit 08bf709e authored by renatog's avatar renatog Committed by renatog
Browse files

Issue #3270595 by RenatoG: Insert a message to convert all classes to...

Issue #3270595 by RenatoG: Insert a message to convert all classes to uppercase/lowercase after edit the settings page with default case
parent 72bf9a42
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -257,6 +257,11 @@ class BlockClassSettingsForm extends ConfigFormBase {
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {

    // Get the config object.
    $config = $this->config('block_class.settings');

    $previous_default_case = $config->get('default_case');

    // Get the default case.
    $default_case = $form_state->getValue('default_case');

@@ -280,9 +285,6 @@ class BlockClassSettingsForm extends ConfigFormBase {

    $filter_html_clean_css_identifier = $form_state->getValue('filter_html_clean_css_identifier');

    // Get the config object.
    $config = $this->config('block_class.settings');

    // Set the values.
    $config->set('default_case', $default_case);
    $config->set('field_type', $field_type);
@@ -297,6 +299,15 @@ class BlockClassSettingsForm extends ConfigFormBase {
    $config->save();

    parent::submitForm($form, $form_state);

    if ($previous_default_case != $default_case) {

      $this->messenger->addStatus($this->t('Now you are using @default_case@ as a default case. If you want to convert all classes stored, feel free run the <a href="/admin/config/content/block-class/bulk-operations">Bulk Update</a> to convert all to @default_case@', [
        '@default_case@' => $default_case,
      ]));

    }

  }

}