You are here

function theme_site_map_order in Site map 8

Same name and namespace in other branches
  1. 7 includes/site_map.theme.inc \theme_site_map_order()

Returns HTML for the site map order form.

Copied from the core theme_filter_admin_format_filter_order() function.

Parameters

array $variables: An associative array containing:

  • element: A render element representing the form.
1 string reference to 'theme_site_map_order'
site_map_theme in ./site_map.module
Implements hook_theme().
1 theme call to theme_site_map_order()
SitemapSettingsForm::buildForm in src/Form/SitemapSettingsForm.php
Form constructor.

File

./site_map.theme.inc, line 234
Site map theme functions.

Code

function theme_site_map_order(array $variables) {
  $element = $variables['element'];

  // Site map order (tabledrag).
  $rows = array();
  foreach (Element::children($element, TRUE) as $name) {
    $element[$name]['weight']['#attributes']['class'][] = 'site-map-order-weight';
    $rows[] = array(
      'data' => array(
        drupal_render($element[$name]['content']),
        drupal_render($element[$name]['weight']),
      ),
      'class' => array(
        'draggable',
      ),
    );
  }
  $output = drupal_render_children($element);
  $table = array(
    '#type' => 'table',
    '#rows' => $rows,
    '#attributes' => array(
      'id' => 'site-map-order',
    ),
    '#tabledrag' => array(
      array(
        'action' => 'order',
        'relationship' => 'sibling',
        'group' => 'site-map-order-weight',
        'hidden' => TRUE,
      ),
    ),
  );
  $output .= drupal_render($table);
  return $output;
}