You are here

function theme_openlayers_ui_presets_form in Openlayers 6.2

Theme function for presets form

File

modules/openlayers_ui/includes/openlayers_ui.theme.inc, line 38
This file holds the theme functions for openlayers ui module

Code

function theme_openlayers_ui_presets_form($form) {
  $links = $panels = array();
  $first = TRUE;
  foreach (element_children($form) as $key) {
    if (!isset($form[$key]['#type']) && element_children($form[$key]) && $key != 'buttons') {
      $class = $first ? 'openlayers-panel-active' : '';
      $links[$key] = array(
        'title' => $form[$key]['#title'],
        'href' => $_GET['q'],
        'fragment' => "openlayers-panel-{$key}",
        'attributes' => array(
          'class' => $class,
        ),
      );
      unset($form[$key]['#title']);
      $panels[$key] = "<div class='openlayers-panel openlayers-panel-{$key} {$class}'>";
      $panels[$key] .= isset($form[$key]['#description']) ? "<div class='description'>{$form[$key]['#description']}</div>" : '';
      $panels[$key] .= drupal_render($form[$key]);
      $panels[$key] .= "</div>";
      $first = FALSE;
    }
  }
  $panels = implode("\n", $panels);
  $links = theme('links', $links, array(
    'id' => 'openlayers-panel-links',
  ));
  $buttons = drupal_render($form['buttons']);
  $form = drupal_render($form);
  $left = "<div class='openlayers-column-left'>{$links}<div class='buttons'>{$buttons}</div></div>";
  $right = "<div class='openlayers-column-right'>{$panels}{$form}</div>";
  return $right . $left;
}