You are here

function spaces_get_menu_editor in Spaces 6.3

Same name and namespace in other branches
  1. 7.3 spaces.module \spaces_get_menu_editor()
  2. 7 spaces.module \spaces_get_menu_editor()
1 string reference to 'spaces_get_menu_editor'
spaces_block in ./spaces.module
Implementation of hook_block().

File

./spaces.module, line 856

Code

function spaces_get_menu_editor(&$form_state) {
  jquery_ui_add(array(
    'ui.draggable',
    'ui.droppable',
    'ui.sortable',
  ));

  // @TODO: Use Libraries API to split these JS libraries out.
  drupal_add_js(drupal_get_path('module', 'context_ui') . '/json2.js');
  drupal_add_js(drupal_get_path('module', 'context_ui') . '/jquery.pageEditor.js');
  drupal_add_js(drupal_get_path('module', 'spaces') . '/spaces.js');
  drupal_add_css(drupal_get_path('module', 'spaces') . '/spaces.css');

  // Start from a system_settings_form.
  $form = system_settings_form(array());
  unset($form['#theme']);
  $form['#attributes'] = array(
    'class' => 'spaces-menu-editor',
  );
  $form['space_menu_items'] = array(
    '#type' => 'hidden',
    '#element_validate' => array(
      'spaces_menu_items_validate',
    ),
  );
  $form['buttons']['edit'] = array(
    '#submit' => array(),
    '#type' => 'submit',
    '#value' => t('Edit'),
    '#attributes' => array(
      'class' => 'spaces-menu-editor',
    ),
  );
  $form['buttons']['reset']['#access'] = FALSE;
  $form['buttons']['submit']['#value'] = t('Save');
  $form['buttons']['submit']['#attributes'] = array(
    'class' => 'spaces-menu-save',
    'style' => 'display: none;',
  );
  $form['buttons']['cancel'] = array(
    '#submit' => array(),
    '#value' => t('Cancel'),
    '#type' => 'button',
    '#attributes' => array(
      'class' => 'spaces-menu-cancel',
      'style' => 'display: none;',
    ),
  );
  return $form;
}