You are here

function _spaces_features_form in Spaces 5.2

Same name and namespace in other branches
  1. 6 spaces_admin.inc \_spaces_features_form()
  2. 6.2 spaces_admin.inc \_spaces_features_form()

Core form for controlling features / settings

2 calls to _spaces_features_form()
spaces_features_form in ./spaces_admin.inc
FEATURE SETTINGS ===================================================
spaces_preset_form in ./spaces_admin.inc
Form for adding or editing a spaces preset.

File

./spaces_admin.inc, line 560

Code

function _spaces_features_form($space) {
  $form = array();
  $form['space'] = array(
    '#type' => 'value',
    '#value' => $space,
  );
  $form['features'] = array(
    '#type' => 'fieldset',
    '#title' => t('Features'),
    '#description' => t('Control the features are enabled for this group by adjusting the settings below. Private features will limit access to members of this group, while public features allow any users to view any content within that feature.'),
    '#tree' => TRUE,
  );
  $form['settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Settings'),
    '#description' => t('Settings are options for customizing your group that do not affect the privacy of your content.'),
    '#tree' => TRUE,
  );

  // Generate features form
  foreach (spaces_features($space->type) as $id => $feature) {
    $options = $space
      ->feature_options() ? $space
      ->feature_options() : array();

    // TODO: reimplement option limiting as part of blueprinting
    if (count($options) > 0) {
      $form['features'][$id] = array(
        '#type' => 'select',
        '#title' => $feature->spaces['label'],
        '#description' => $feature->spaces['description'],
        '#options' => $options,
        '#default_value' => isset($space->features[$id]) ? $space->features[$id] : SPACES_FEATURE_DISABLED,
      );
    }
  }

  // Generate settings form
  foreach (spaces_settings() as $setting) {
    $setting_value = isset($space->settings[$setting->id]) ? $space->settings[$setting->id] : NULL;
    $form['settings'][$setting->id] = $setting
      ->form($space, $setting_value);
  }
  return $form;
}