-Current API Version: 2.0.3
+Current API Version: 2.0.4
Please note that the API version is an internal number and does not match release numbers. It is entirely possible that releases will not increase the API version number, and increasing this number too often would burden contrib module maintainers who need to keep up with API changes.
This file contains a log of changes to the API.
+API Version 2.0.4
+ Introduce ctools_form_include_file()
-API Version 2.0.2
+API Version 2.0.3
Introduce ctools_field_invoke_field() and
API Version 2.0.2
* must be implemented in the module file.
*/
-define('CTOOLS_API_VERSION', '2.0.3');
+define('CTOOLS_API_VERSION', '2.0.4');
/**
* Test the CTools API version.
* the form_state so that cached forms will properly include things.
*/
function ctools_form_include(&$form_state, $file, $module = 'ctools', $dir = 'includes') {
+ if (!isset($form_state['build_info']['args'])) {
+ $form_state['build_info']['args'] = array();
+ }
+
$dir = '/' . ($dir ? $dir . '/' : '');
form_load_include($form_state, 'inc', $module, $dir . $file);
}
/**
+ * Add an arbitrary path to the $form_state so it can work with form cache.
+ *
+ * module_load_include uses an unfortunately annoying syntax to work, making it
+ * difficult to translate the more simple $path + $file syntax.
+ */
+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;
+}
+
+/**
* Provide the proper path to an image as necessary.
*
* This helper function is used by ctools but can also be used in other
* whatever information the form(s) involved left for it.
*/
function ctools_wizard_multistep_form($form_info, $step, &$form_state) {
+ // Make sure 'wizard' always exists for the form when dealing
+ // with form caching.
+ ctools_form_include($form_state, 'wizard');
+
// allow order array to be optional
if (empty($form_info['order'])) {
foreach ($form_info['forms'] as $step_id => $params) {
if (!empty($info['include'])) {
if (is_array($info['include'])) {
foreach ($info['include'] as $file) {
- require_once DRUPAL_ROOT . '/' . $file;
+ ctools_form_include_file($form_state, $file);
}
}
else {
- require_once DRUPAL_ROOT . '/' . $info['include'];
+ ctools_form_include_file($form_state, $info['include']);
}
}