You are here

function ctools_form_include_file in Chaos Tool Suite (ctools) 7

Add an arbitrary path to the $form_state so it can work with form cache.

The module_load_include() function uses an unfortunately annoying syntax to work, making it difficult to translate the more simple $path + $file syntax.

2 calls to ctools_form_include_file()
ctools_wizard_multistep_form in includes/wizard.inc
Display a multi-step form.
_ctools_export_ui_add_form_files in plugins/export_ui/ctools_export_ui.class.php
Add all appropriate includes to forms so that caching the form still loads the files that we need.

File

./ctools.module, line 159
CTools primary module file.

Code

function ctools_form_include_file(&$form_state, $filename) {
  if (!isset($form_state['build_info']['args'])) {
    $form_state['build_info']['args'] = array();
  }

  // Now add this to the build info files so that AJAX requests will know to load it.
  $form_state['build_info']['files']["{$filename}"] = $filename;
  require_once DRUPAL_ROOT . '/' . $filename;
}