You are here

function asaf_form_alter in Asaf (ajax submit for any form) 8

Same name and namespace in other branches
  1. 7 asaf.module \asaf_form_alter()

File

./asaf.module, line 36
Main module file.

Code

function asaf_form_alter(&$form, &$form_state, $form_id) {
  $buttons = asaf_is_handled_form($form_id);
  if (\Drupal::config('asaf_settings.config')
    ->get('asaf_show_form_ids')) {
    drupal_set_message(t('Form id: %form_id', array(
      '%form_id' => $form_id,
    )));
  }
  if (isset($buttons) && is_array($buttons)) {
    $options = array();
    if (\Drupal::config('asaf_settings.config')
      ->get('asaf_autoload_form_stuff')) {
      $options['needed_files'] = asaf_get_form_stuff($form, $form_state, $form_id);
    }
    asaf_prepare_form($form, $form_state, $buttons, $options);
  }
}