You are here

function spaces_get_menu_editor in Spaces 7.3

Same name and namespace in other branches
  1. 6.3 spaces.module \spaces_get_menu_editor()
  2. 7 spaces.module \spaces_get_menu_editor()

@todo Please document this function.

See also

http://drupal.org/node/1354

1 string reference to 'spaces_get_menu_editor'
spaces_block_view in ./spaces.module
Implements hook_block_view().

File

./spaces.module, line 919

Code

function spaces_get_menu_editor($form, &$form_state) {
  drupal_add_library('system', 'ui.draggable');
  drupal_add_library('system', 'ui.droppable');
  drupal_add_library('system', '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' => array(
      'spaces-menu-editor',
    ),
  );
  $form['space_menu_items'] = array(
    '#type' => 'hidden',
    '#element_validate' => array(
      'spaces_menu_items_validate',
    ),
  );
  $form['actions']['edit'] = array(
    '#submit' => array(),
    '#type' => 'submit',
    '#value' => t('Edit'),
    '#attributes' => array(
      'class' => array(
        'spaces-menu-editor',
      ),
    ),
  );

  //$form['actions']['reset']['#access'] = FALSE;
  $form['actions']['submit']['#value'] = t('Save');
  $form['actions']['submit']['#attributes'] = array(
    'class' => array(
      'spaces-menu-save',
    ),
    'style' => array(
      'display: none;',
    ),
  );
  $form['actions']['cancel'] = array(
    '#submit' => array(),
    '#value' => t('Cancel'),
    '#type' => 'button',
    '#attributes' => array(
      'class' => array(
        'spaces-menu-cancel',
      ),
      'style' => array(
        'display: none;',
      ),
    ),
  );
  return $form;
}