You are here

function hook_webform_analysis_component_data_alter in Webform 7.4

Alter data when displaying an analysis on that component.

This hook modifies the data from an individual component's analysis results. It can be used to add additional analysis, or to modify the existing results. If needing to alter the entire set of analyses rather than an individual component, hook_webform_analysis_alter() may be used instead.

Parameters

array $data: An array containing the result of a components analysis hook, passed by reference. This is passed directly from a component's _webform_analysis_component() function. See that hook for more information on this value.

object $node: The node object that contains the component being analyzed.

array $component: The Webform component array whose analysis results are being displayed.

See also

_webform_analysis_component()

hook_webform_analysis_alter()

Related topics

1 invocation of hook_webform_analysis_component_data_alter()
webform_results_analysis in includes/webform.report.inc
Provides a simple analysis of all submissions to a webform.

File

./webform.api.php, line 398
Sample hooks demonstrating usage in Webform.

Code

function hook_webform_analysis_component_data_alter(array &$data, $node, array $component) {
  if ($component['type'] === 'textfield') {

    // Do not display rows that contain a zero value.
    foreach ($data as $row_number => $row_data) {
      if ($row_data[1] === 0) {
        unset($data[$row_number]);
      }
    }
  }
}