You are here

function theme_forena_element_draggable in Forena Reports 8

Same name and namespace in other branches
  1. 7.5 forena.report.inc \theme_forena_element_draggable()
  2. 7.4 forena.report.inc \theme_forena_element_draggable()
5 theme calls to theme_forena_element_draggable()
FrxCrosstab::configForm in src/FrxPlugin/Template/FrxCrosstab.php
Crosstab configuration form.
FrxFieldTable::configForm in src/FrxPlugin/Template/FrxFieldTable.php
Template configuration form @parmater $configuration form
FrxSection::configForm in src/FrxPlugin/Template/FrxSection.php
Generate configuration.
FrxSVGGraph::configForm in src/FrxPlugin/Template/FrxSVGGraph.php
FrxTable::configForm in src/FrxPlugin/Template/FrxTable.php

File

./forena.report.inc, line 1465

Code

function theme_forena_element_draggable($variables) {
  $output = '';
  $element = $variables['element'];
  $id = $element['#draggable_id'];
  $headers = array();
  $rows = array();
  foreach (\Drupal\Core\Render\Element::children($element) as $e_key) {
    $element[$e_key]['weight']['#attributes']['class'] = array(
      $id . '-weight',
    );
    $row = array();
    foreach (\Drupal\Core\Render\Element::children($element[$e_key]) as $ctl) {
      if (isset($element[$e_key][$ctl]['#title'])) {
        $headers[$ctl] = $element[$e_key][$ctl]['#title'];
        $element[$e_key][$ctl]['#title_display'] = 'invisible';
        $e = drupal_render($element[$e_key][$ctl]);
        $row[] = $e;
      }
    }
    $rows[] = array(
      'data' => $row,
      'class' => array(
        'draggable',
      ),
    );
  }
  $output = _theme('table', array(
    'header' => $headers,
    'rows' => $rows,
    'attributes' => array(
      'id' => $id,
    ),
  ));
  drupal_add_tabledrag($id, 'order', 'group', $id . '-weight');

  //$output .= drupal_render_children($element);
  return $output;
}