You are here

function space_setting_home::form in Spaces 6.2

Same name and namespace in other branches
  1. 5.2 spaces.module \space_setting_home::form()
  2. 6 spaces.module \space_setting_home::form()

Overrides space_setting::form

File

./spaces.spaces.inc, line 17

Class

space_setting_home
Provides a homepage setting for each space.

Code

function form($space, $value = array()) {
  $options = array(
    0 => '---',
  );

  // This is exceedingly hackish but effective way of ensuring that
  // the link options provided are correct, especially when being
  // generated on preset forms.
  $original = spaces_get_space();
  spaces_set_space($space, TRUE);
  $links = menu_navigation_links('features');
  spaces_set_space($original, TRUE);
  $form = array();
  if (count($links)) {
    foreach ($links as $link) {
      $options[$link['href']] = $link['title'];
    }
    $form = array(
      '#title' => t('Homepage'),
      '#description' => t('The default page for this space.'),
      '#type' => 'select',
      '#options' => $options,
      '#default_value' => $value ? $value : 0,
    );
  }
  return $form;
}