You are here

function theme_om_maximenu_links_order in OM Maximenu 6

Same name and namespace in other branches
  1. 8 inc/om_maximenu.admin.inc \theme_om_maximenu_links_order()
  2. 7 inc/om_maximenu.admin.inc \theme_om_maximenu_links_order()

Implementation of theme_hook()

  • View in table format
1 theme call to theme_om_maximenu_links_order()
_om_maximenu_admin in inc/om_maximenu.admin.inc
Admin Form

File

inc/om_maximenu.admin.inc, line 955
OM Maximenu Admin Configuration

Code

function theme_om_maximenu_links_order($form) {

  //dsm($form);
  $menu_key = $form['menu_key']['#value'];
  $output = '';

  //dsm($form['layout']);
  $rows = array();
  foreach ($form as $key => $prop) {
    if (is_numeric($key)) {
      $row = array();

      // Strips labels
      unset($prop['weight']['#title']);
      unset($prop['weight']['#description']);
      unset($prop['link_delete']['#title']);
      unset($form[$key]['#description']);
      unset($form[$key]['weight']);
      unset($form[$key]['link_delete']);
      $row[] = array(
        'class' => 'col-link',
        'data' => drupal_render($form[$key]),
      );
      $row[] = array(
        'class' => 'col-attached',
        'data' => $prop['#description'],
      );
      $row[] = array(
        'class' => 'col-weight',
        'data' => drupal_render($prop['weight']),
      );
      $row[] = array(
        'class' => 'col-delete',
        'data' => drupal_render($prop['link_delete']),
      );
      $rows[] = array(
        'data' => $row,
        'id' => 'om-row-' . $menu_key . '-' . $key,
        'class' => 'draggable row-' . $key . ' tabledrag-leaf',
      );
    }
  }
  $header = array(
    t('Link'),
    t('Attached Blocks'),
    t('Weight'),
    t('Delete'),
  );

  //, 'Update'

  // Header
  $form['#children'] = theme('table', $header, $rows, array(
    'id' => 'om-maximenu-links-' . $menu_key,
  ));

  //drupal_add_tabledrag($table_id, $action, $relationship, $group, $subgroup = NULL, $source = NULL, $hidden = TRUE, $limit = 0);
  drupal_add_tabledrag('om-maximenu-links-' . $menu_key, 'order', 'group', 'om-weight');
  $output .= drupal_render($form);
  return $output;
}