You are here

function theme_spaces_ui_feature_form_menu in Spaces 5.2

Custom form theming for spaces feature menu.

1 theme call to theme_spaces_ui_feature_form_menu()
spaces_ui_form_alter in ./spaces_ui.module
Implementation of hook_form_alter()

File

./spaces_ui.module, line 293

Code

function theme_spaces_ui_feature_form_menu($form) {
  drupal_add_js(drupal_get_path('module', 'spaces_ui') . '/spaces_ui.js');
  drupal_add_css(drupal_get_path('module', 'spaces_ui') . '/spaces.css');

  // Render help markup first
  $output = drupal_render($form['help']);

  // Render menu items in a table
  $rows = array();
  foreach (element_children($form) as $element) {
    if (is_numeric($element)) {
      $class = !$form[$element]['title']['#default_value'] ? 'hidden' : '';
      $rows[] = array(
        'data' => array(
          drupal_render($form[$element]['title']),
          drupal_render($form[$element]['path']),
          l(t('Remove'), $_GET['q'], array(
            'class' => 'spaces-remove-menu',
          )),
        ),
        'class' => $class,
      );
    }
  }

  // Add an ajax button
  $rows[] = array(
    array(
      'data' => l(t('Add menu item'), $_GET['q'], array(
        'class' => 'button spaces-add-menu',
      )),
      'colspan' => 3,
      'class' => 'actions',
    ),
  );
  $output .= theme('table', array(
    t('Title'),
    t('Path'),
    '',
  ), $rows, array(
    'class' => 'spaces-admin',
  ));
  return $output;
}