You are here

function views_process_dependency in Views Calc 7

File

./views_calc.module, line 564
This module will allow you to add calculated fields to views tables and compute (SUM, COUNT, AVG, etc) columns of numeric data in a views table.

Code

function views_process_dependency($element, $edit, &$form_state, &$form) {
  static $dependencies;
  if (isset($element['#dependency']) && !isset($dependencies[$element['#id']])) {
    if (!isset($element['#dependency_count'])) {
      $element['#dependency_count'] = 1;
    }
    if (!empty($form_state['ajax'])) {
      $form_state['js settings']['viewsAjax']['formRelationships'][$element['#id']] = array(
        'num' => $element['#dependency_count'],
        'values' => $element['#dependency'],
      );
    }
    else {
      views_add_js('dependent');
      $options['viewsAjax']['formRelationships'][$element['#id']] = array(
        'num' => $element['#dependency_count'],
        'values' => $element['#dependency'],
      );
      drupal_add_js($options, 'setting');
    }
    $dependencies[$element['#id']] = TRUE;
  }
  return $element;
}