You are here

class space_setting_home in Spaces 5.2

Same name and namespace in other branches
  1. 6 spaces.module \space_setting_home
  2. 6.2 spaces.spaces.inc \space_setting_home

Provides a homepage setting for each space.

Hierarchy

Expanded class hierarchy of space_setting_home

File

./spaces.module, line 387

View source
class space_setting_home implements space_setting {
  var $id = 'home';
  function form($space, $value = array()) {
    $options = array(
      0 => '---',
    );
    foreach (spaces_features($space->type) as $f => $feature) {
      if ($feature->spaces['menu'] && $space->features[$f] != SPACES_FEATURE_DISABLED) {
        $options[$f] = $feature->spaces['label'];
      }
    }
    $form = array(
      '#title' => t('Homepage'),
      '#description' => t('The default page for this space.'),
      '#type' => 'select',
      '#options' => $options,
      '#validate' => array(
        'spaces_setting_validate' => array(
          $this->id,
        ),
      ),
      '#default_value' => $value ? $value : 0,
    );
    return $form;
  }
  function validate($space, $value) {

    // Exclude space "prototypes" (like that used for the preset form)
    if ($space->sid) {
      if (!$value && is_array($space->features) && array_sum($space->features) != 0) {
        form_set_error('settings][' . $this->id, t('You must select a homepage for this space.'));
      }
    }
  }
  function submit($space, $value) {
    return $value;
  }

}

Members