You are here

function theme_forena_report_parameters_form in Forena Reports 8

Same name and namespace in other branches
  1. 7.5 forena.report.inc \theme_forena_report_parameters_form()
  2. 7.4 forena.report.inc \theme_forena_report_parameters_form()

Theme function for the draggable parameters form.

Parameters

unknown $variables:

Return value

Ambigous <string, A, boolean>

File

./forena.report.inc, line 1437

Code

function theme_forena_report_parameters_form($variables) {
  $form =& $variables['form'];
  $headers = array();
  $rows = array();

  // Iterate the controls of the table giving some labels.
  foreach (\Drupal\Core\Render\Element::children($form['parameters']) as $e_key) {
    $form['parameters'][$e_key]['weight']['#attributes']['class'] = array(
      'parameters-weight',
    );
    $row = array();
    foreach (\Drupal\Core\Render\Element::children($form['parameters'][$e_key]) as $ctl) {
      if (isset($form['parameters'][$e_key][$ctl]['#title'])) {
        $headers[$ctl] = $form['parameters'][$e_key][$ctl]['#title'];
      }
      $row[] = drupal_render($form['parameters'][$e_key][$ctl]);
    }
    $rows[] = array(
      'data' => $row,
      'class' => array(
        'draggable',
      ),
    );
  }
  $headers = array_values($headers);
  $output = _theme('table', array(
    'header' => $headers,
    'rows' => $rows,
    'attributes' => array(
      'id' => 'forena-parameters',
    ),
  ));

  // Render the rest of the children.
  $output .= drupal_render_children($form);
  drupal_add_tabledrag('forena-parameters', 'order', 'group', 'parameters-weight');
  return $output;
}