webform_ajax.install in Webform Ajax 7.2
Same filename and directory in other branches
Webform AJAX install file.
Alter Webform table schema to add the AJAX property to a webform.
File
webform_ajax.installView source
<?php
/**
* @file
* Webform AJAX install file.
*
* Alter Webform table schema to add the AJAX property to a webform.
*/
/**
* Implements hook_schema_alter().
*/
function webform_ajax_schema_alter(&$schema) {
// Define our additional fields.
if (isset($schema['webform'])) {
// Declare new column for webform_ajax property.
$schema['webform']['fields']['webform_ajax'] = array(
'description' => 'Value of a webform for AJAX with confirm screen (1), no confirm screen (-1) or no AJAX (0).',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
);
}
}
/**
* Implements hook_install().
*/
function webform_ajax_install() {
// Update schema. Add our additional fields.
$schema = array(
'webform' => array(),
);
webform_ajax_schema_alter($schema);
foreach ($schema as $table => $table_def) {
foreach ($table_def['fields'] as $field => $spec) {
db_add_field($table, $field, $spec);
}
}
}
/**
* Implements hook_uninstall().
*/
function webform_ajax_uninstall() {
// Update schema. Drop our additional fields.
$schema = array(
'webform' => array(),
);
webform_ajax_schema_alter($schema);
foreach ($schema as $table => $table_def) {
foreach ($table_def['fields'] as $field => $spec) {
db_drop_field($table, $field);
}
}
}
Functions
Name![]() |
Description |
---|---|
webform_ajax_install | Implements hook_install(). |
webform_ajax_schema_alter | Implements hook_schema_alter(). |
webform_ajax_uninstall | Implements hook_uninstall(). |