You are here

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

Same name and namespace in other branches
  1. 7 modules/asaf_example/asaf_example.api.needed_files.inc \asaf_example_api_needed_files()
1 string reference to 'asaf_example_api_needed_files'
asaf_example_menu in modules/asaf_example/asaf_example.module
Implements hook_menu().

File

modules/asaf_example/asaf_example.api.needed_files.inc, line 3

Code

function asaf_example_api_needed_files($form, &$form_state) {
  $form['up'] = array(
    '#markup' => l('← Go to the examples list', 'examples/asaf_example'),
  );
  $form['email'] = array(
    '#type' => 'textfield',
    '#title' => t('Email'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Check email'),
  );
  module_load_include('inc', 'asaf_example', 'asaf_example.api.needed_files.handlers');
  $form['#validate'][] = 'asaf_example_api_needed_files_validate';
  $form['#submit'][] = 'asaf_example_api_needed_files_submit';

  // In cases when some part of form handlers located in the another place you can specify paths to files which should
  // be loaded for the correct form handling
  $options = array(
    'needed_files' => array(
      // You can specify file dirrectly...
      drupal_get_path('module', 'asaf_example') . '/asaf_example.api.needed_files.handlers.inc',
    ),
  );
  asaf_prepare_form($form, $form_state, array(), $options);
  return $form;
}