webform_node_value.install in Webform Node Value 7
Webform node_value installation.
File
webform_node_value.installView source
<?php
/**
* @file
* Webform node_value installation.
*/
/**
* Implementation of hook_schema().
*/
function webform_node_value_schema() {
$schema['webform_node_value'] = array(
'fields' => array(
'nid' => array(
'description' => 'nid of node this webform belongs to.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
'default' => NULL,
),
'node_path_source' => array(
'type' => 'varchar',
'length' => 5,
'not null' => TRUE,
'default' => '',
'description' => 'Where to get the path to the node.',
),
'prefix' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'Prefix to add to the path alias of the node.',
),
'webform_source' => array(
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
'description' => "Webform source field name.",
),
'node_field_name' => array(
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
'description' => 'Node field name to get info from.',
),
'webform_destination' => array(
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
'description' => 'Node field name to get info from.',
),
),
'primary key' => array(
'nid',
),
);
return $schema;
}
/**
* Implementation of hook_uninstall().
*/
function webform_node_value_uninstall() {
drupal_uninstall_schema('webform_node_value');
}
/**
* Add option to use path of page webform is on.
*
**/
function webform_node_value_update_7101() {
// Set the target table and field name.
$table_name = 'webform_node_value';
$field_name = 'node_path_source';
// Describe the new field.
$field_spec = array(
'type' => 'varchar',
'length' => 5,
'not null' => TRUE,
'default' => '',
'description' => 'Where to get the path to the node.',
);
// Add it and update the primary key.
db_add_field($table_name, $field_name, $field_spec);
db_drop_primary_key($table_name);
db_add_primary_key($table_name, array(
'nid',
));
// Update User values.
$result = db_query("UPDATE {webform_node_value} SET node_path_source = 'field'");
if ($result
->rowCount() > 0) {
drupal_set_message(t('Updated Webform Node Value settings'));
}
}
Functions
Name![]() |
Description |
---|---|
webform_node_value_schema | Implementation of hook_schema(). |
webform_node_value_uninstall | Implementation of hook_uninstall(). |
webform_node_value_update_7101 | Add option to use path of page webform is on. |