You are here

function views_calc_export_form in Views Calc 7

Same name and namespace in other branches
  1. 6.3 views_calc.module \views_calc_export_form()
  2. 6 views_calc.module \views_calc_export_form()

FAPI export_form.

Field export form.

1 string reference to 'views_calc_export_form'
views_calc_menu in ./views_calc.module
Implements hook_menu().

File

./views_calc.module, line 485
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_export_form($form, &$form_state) {
  $fields = _views_calc_fields();
  $string = '';
  foreach ($fields as $field) {
    $base = $field->base;
    $substitutions = _views_calc_substitutions($base);
    $field->calc = strtr($field->calc, $substitutions);
    $string .= "\$fields[] = " . var_export((array) $field, TRUE) . ";\n";
  }
  $form['#prefix'] = t('This form will export Views Calc custom fields.');
  $form['macro'] = array(
    '#type' => 'textarea',
    '#rows' => 20,
    '#title' => t('Export data'),
    '#default_value' => $string,
    '#description' => t('This is an export of the custom Views Calc fields. Paste this text into a Views Calc import box to import these fields into another installation. This will only work if the other installation uses the same base tables required by these fields.'),
  );
  return $form;
}