webform_attributes.module in Webform Attributes 7
Same filename and directory in other branches
Functions related the Webform Attributes.
File
webform_attributes.moduleView source
<?php
/**
* @file
* Functions related the Webform Attributes.
*/
/**
* Implements hook_form_FORM_ID_alter().
*/
function webform_attributes_form_webform_configure_form_alter(&$form, &$form_state) {
_webform_attributes_files_include();
// Custom textarea to add attributes on form.
$form['advanced']['webform_attributes_form'] = array(
'#type' => 'textarea',
'#default_value' => _webform_attributes_find_record_by_nid($form['#node']->nid),
'#title' => t('HTML attributes'),
'#description' => t('Key-value pairs MUST be specified as "attribute_name|attribute_value". Use of only alphanumeric characters and underscores is recommended in keys. One attribute per line.'),
'#required' => FALSE,
'#weight' => -8,
);
// Add custom submit function to save values in database.
$form['#submit'][] = "webform_attributes_configure_form_submit";
}
/**
* Implements hook_form_FORM_ID_alter().
*/
function webform_attributes_form_webform_client_form_alter(&$form, &$form_state) {
_webform_attributes_files_include();
// Get attributes in database.
if ($attributes = _webform_attributes_find_record_by_nid($form['#node']->nid, FALSE)) {
_webform_attributes_inside_attributes($form, $attributes);
}
}
/**
* Implements hook_webform_component_render_alter().
*/
function webform_attributes_webform_component_render_alter(&$element, &$component) {
_webform_attributes_files_include();
// Alter render for all components.
_webform_attributes_webform_component_render_alter_all_components($element, $component);
}
/**
* Files include.
*/
function _webform_attributes_files_include() {
module_load_include('inc', 'webform_attributes', 'includes/webform_attributes.functions');
}
/**
* Implements hook_form_webform_component_edit_form_alter().
*/
function webform_attributes_form_webform_component_edit_form_alter(&$form, &$form_state, $form_id) {
_webform_attributes_files_include();
$node = $form['#node'];
// Add custom error message for all components.
_webform_attributes_form_webform_component_edit_form_alter_all_components($form, $form_state, $form_id, $node);
}
Functions
Name![]() |
Description |
---|---|
webform_attributes_form_webform_client_form_alter | Implements hook_form_FORM_ID_alter(). |
webform_attributes_form_webform_component_edit_form_alter | Implements hook_form_webform_component_edit_form_alter(). |
webform_attributes_form_webform_configure_form_alter | Implements hook_form_FORM_ID_alter(). |
webform_attributes_webform_component_render_alter | Implements hook_webform_component_render_alter(). |
_webform_attributes_files_include | Files include. |