diff --git a/help_text.info.yml b/help_text.info.yml index d1dd4e4..d854fb1 100644 --- a/help_text.info.yml +++ b/help_text.info.yml @@ -2,5 +2,6 @@ name: Help Text type: module description: Provides a toggle option for help text in forms. core: 8.x +configure: help_text.settings dependencies: - fontawesome diff --git a/help_text.module b/help_text.module index 130f949..23dd98e 100644 --- a/help_text.module +++ b/help_text.module @@ -26,12 +26,12 @@ function help_text_form_alter(&$form, FormStateInterface $form_state, $form_id) $form['#attached']['library'][] = 'help_text/help_text'; // Pass module config to javascript - $form['#attached']['drupalSettings']['help_text_toggle'] = array( + $form['#attached']['drupalSettings']['help_text_toggle'] = [ 'icon' => $help_text_conf->get('font_awesome_icon'), 'icon_size' => $help_text_conf->get('icon_size'), 'title' => $help_text_conf->get('icon_title_text'), 'alt' => $help_text_conf->get('icon_alt_text'), - ); + ]; } // Else only add help text toggle to node forms. else if($form_object instanceof NodeForm) { @@ -39,12 +39,12 @@ function help_text_form_alter(&$form, FormStateInterface $form_state, $form_id) $form['#attached']['library'][] = 'help_text/help_text'; // Pass module config to javascript - $form['#attached']['drupalSettings']['help_text_toggle'] = array( + $form['#attached']['drupalSettings']['help_text_toggle'] = [ 'icon' => $help_text_conf->get('font_awesome_icon'), 'icon_size' => $help_text_conf->get('icon_size'), 'title' => $help_text_conf->get('icon_title_text'), 'alt' => $help_text_conf->get('icon_alt_text'), - ); + ]; } } diff --git a/src/Form/HelpTextSettingsForm.php b/src/Form/HelpTextSettingsForm.php index 8a938c3..536a2e0 100644 --- a/src/Form/HelpTextSettingsForm.php +++ b/src/Form/HelpTextSettingsForm.php @@ -41,7 +41,7 @@ class HelpTextSettingsForm extends ConfigFormBase { $form['icon_size'] = [ '#type' => 'select', '#title' => $this->t('Icon Size'), - '#options' =>array(' ' => t('Small'),'fa-lg' => t('Medium'),'fa-2x'=> t('Large'), 'fa-3x'=> t('X-Large'), 'fa-4x'=> t('XX-Large'), 'fa-5x'=> t('XXX-Large')), + '#options' =>[' ' => t('Small'),'fa-lg' => t('Medium'),'fa-2x'=> t('Large'), 'fa-3x'=> t('X-Large'), 'fa-4x'=> t('XX-Large'), 'fa-5x'=> t('XXX-Large')], '#description' => $this->t("Font Awesome size to use for the icon."), '#default_value' => $config->get('icon_size'), ];