You are here

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

Same name and namespace in other branches
  1. 7 asaf.module \asaf_get_handled_forms_list()
1 call to asaf_get_handled_forms_list()
asaf_is_handled_form in ./asaf.module

File

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

Code

function asaf_get_handled_forms_list() {
  return;
  $forms = array();
  $text = \Drupal::config('asaf_settings.config')
    ->get('asaf_forms');
  $lines = explode("\n", $text);
  foreach ($lines as $line) {
    $parts = explode('@', trim($line));
    $form_id = isset($parts[0]) ? $parts[0] : '';
    $buttons = isset($parts[1]) ? $parts[1] : '';
    $form_id = trim($form_id);
    $buttons = trim($buttons);
    if ($form_id) {
      $forms[$form_id] = array();
      if ($buttons) {
        $forms[$form_id] = array(
          'included' => array(),
          'excluded' => array(),
        );
        if ($buttons[0] != '+' && $buttons[0] != '-') {
          $buttons = '+' . $buttons;
        }
        preg_match_all('/([\\+\\-][^\\+\\-]+)/', $buttons, $matches);
        if (isset($matches[0]) && is_array($matches[0])) {
          foreach ($matches[0] as $button) {
            $op = $button[0];
            $button = substr($button, 1);
            $forms[$form_id][$op == '+' ? 'included' : 'excluded'][$button] = $button;
          }
        }
        if (!empty($forms[$form_id]['included'])) {
          unset($forms[$form_id]['excluded']);
        }
        else {
          unset($forms[$form_id]['included']);
        }
      }
    }
  }
  drupal_alter('asaf_forms_list', $forms);
  return $forms;
}