You are here

class space_customizer_menu in Spaces 5.2

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

Customizer for feature menus.

Hierarchy

Expanded class hierarchy of space_customizer_menu

File

./spaces.module, line 425

View source
class space_customizer_menu implements space_customizer {
  var $name = 'Menu';
  function form($space, $feature) {
    $features = spaces_features();
    $f = $features[$feature];

    // Customize menus
    if (isset($f->spaces['menu']) && count($f->spaces['menu'])) {

      // Get customized values
      $feature_menu = $f->spaces['menu'];
      $feature_menu = $this
        ->customize($space, $feature, $feature_menu);
      $form = array();
      foreach ($feature_menu as $path => $item) {
        $form[$path] = array(
          '#title' => $path,
          '#type' => 'fieldset',
          '#tree' => TRUE,
        );
        $form[$path]['title'] = array(
          '#title' => t('Title'),
          '#type' => 'textfield',
          '#size' => 40,
          '#maxlength' => 255,
          '#default_value' => $item['title'],
        );
      }
    }
    return $form;
  }
  function validate($space, $feature, $value) {
    return;
  }
  function submit($space, $feature, $value) {
    $features = spaces_features();
    $feature_menu = $features[$feature]->spaces['menu'];
    foreach ($value as $path => $item) {
      if ($item == $feature_menu[$path]) {
        unset($value[$path]);
      }
    }
    return $value;
  }
  function customize($space, $feature, $menu = NULL) {
    if (isset($space->customizer[$feature]['menu'])) {
      $custom_menu = array();
      $customizer = $space->customizer[$feature]['menu'];
      foreach ($menu as $path => $item) {
        if (isset($customizer[$path])) {
          $menu[$path] = $customizer[$path];
        }
      }
    }
    return $menu;
  }

}

Members