You are here

asaf_example.api.needed_files.inc in Asaf (ajax submit for any form) 8

Same filename and directory in other branches
  1. 7 modules/asaf_example/asaf_example.api.needed_files.inc

File

modules/asaf_example/asaf_example.api.needed_files.inc
View source
<?php

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;
}

Functions