You are here

function spaces_customize_form_submit in Spaces 6

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

Submit handler for feature customization form.

1 string reference to 'spaces_customize_form_submit'
spaces_customize_form in ./spaces_admin.inc
Feature customization form.

File

./spaces_admin.inc, line 912

Code

function spaces_customize_form_submit($form, &$form_state) {
  $space = $form_state['values']['space'];
  $feature = $form_state['values']['feature'];

  // Retrieve customizer values
  $customizers = spaces_customizers();
  $feature_customizer = array();
  foreach ($customizers as $id => $customizer) {
    $feature_customizer[$id] = $customizer
      ->submit($space, $feature, $form_state['values']['customizers'][$id]);
  }
  $space->customizer[$feature] = $feature_customizer;

  // Retrieve setting values
  $features = spaces_features();
  if (isset($features[$feature]->spaces['settings'])) {
    foreach ($features[$feature]->spaces['settings'] as $id => $setting) {
      $space->settings[$id] = $setting
        ->submit($space, $form_state['values']['settings'][$id]);
    }
  }

  // Save the space
  spaces_save($space);
  drupal_set_message(t('Customizations saved for space !title.', array(
    '!title' => $space->title,
  )));
}