You are here

js_confirm_pop_up.module in Confirm popup 8

Same filename and directory in other branches
  1. 7 js_confirm_pop_up.module

Implements hook_form_alter().

File

js_confirm_pop_up.module
View source
<?php

/**
 * @file
 * Implements hook_form_alter().
 */
function js_confirm_pop_up_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  $config = \Drupal::service('config.factory')
    ->getEditable('js_confirm_pop_up.settings');
  $form_ids = $config
    ->get('js_confirm_pop_up_id');
  $form_ids_arr = explode(',', $form_ids);
  if (!empty($form_ids_arr)) {
    foreach ($form_ids_arr as $value) {
      if ($form_id == $value) {
        $form['#attributes']['class'][] = 'js-confirm-pop-up';
        $form['#attached']['library'][] = 'js_confirm_pop_up/js_confirm_pop_up_js';
      }
    }
  }
}

Functions

Namesort descending Description
js_confirm_pop_up_form_alter @file Implements hook_form_alter().