function hook_webform_analysis_alter in Webform 7.4
Alter the entire analysis before rendering to the page on the Analysis tab.
This alter hook allows modification of the entire analysis of a node's Webform results. The resulting analysis is displayed on the Results -> Analysis tab on the Webform.
Parameters
array $analysis: A Drupal renderable array, passed by reference, containing the entire contents of the analysis page. This typically will contain the following two major keys:
- form: The form for configuring the shown analysis.
- components: The list of analyses for each analysis-enabled component for the node. Each keyed by its component ID.
Related topics
1 invocation of hook_webform_analysis_alter()
- webform_results_analysis in includes/
webform.report.inc - Provides a simple analysis of all submissions to a webform.
File
- ./
webform.api.php, line 365 - Sample hooks demonstrating usage in Webform.
Code
function hook_webform_analysis_alter(array &$analysis) {
$node = $analysis['#node'];
// Add an additional piece of information to every component's analysis:
foreach (element_children($analysis['components']) as $cid) {
$component = $node->components[$cid];
$analysis['components'][$cid]['chart'] = array(
'#markup' => t('Chart for the @name component', array(
'@name' => $component['name'],
)),
);
}
}