function views_calc_import_form_submit in Views Calc 7
Same name and namespace in other branches
- 6.3 views_calc.module \views_calc_import_form_submit()
- 6 views_calc.module \views_calc_import_form_submit()
FAPI import_form submit.
Submit handler for import form.
File
- ./
views_calc.module, line 542 - 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_calc_import_form_submit($form, &$form_state) {
$form_values = $form_state['values'];
$fields = NULL;
// Use '@' to suppress errors about undefined constants in the macro.
@eval($form_values['macro']);
if (empty($fields) || !is_array($fields)) {
return;
}
foreach ($fields as $delta => $field) {
// Don't over-write existing fields, create new ones.
$fields[$delta]['cid'] = NULL;
}
// Run the values thru drupal_execute() so they are properly validated.
$form_state = array(
'values' => $fields,
);
drupal_form_submit('views_calc_fields_form', $form_state);
}