Exemplo n.º 1
0
 /**
  * Overrides the method to add support for expanded tree nodes.
  *
  * The methods adds the `expanded` option which is used to store expanded tree nodes. The
  * option is initialized with first level pages.
  */
 protected function update_options(Options $options, array $modifiers)
 {
     $options = parent::update_options($options, $modifiers);
     if (!isset($options->expanded)) {
         $options->expanded = array();
     }
     if (isset($modifiers['expand']) || isset($modifiers['collapse'])) {
         $expanded = array_flip($options->expanded);
         if (isset($modifiers['expand'])) {
             $nid = $this->expand_highlight = filter_var($modifiers['expand'], FILTER_VALIDATE_INT);
             $expanded[$nid] = true;
         }
         if (isset($modifiers['collapse'])) {
             unset($expanded[filter_var($modifiers['collapse'], FILTER_VALIDATE_INT)]);
         }
         $options->expanded = array_keys($expanded);
     }
     if ($options->order_by == 'title') {
         $options->order_by = null;
     }
     if ($options->filters || $options->order_by || $options->search) {
         $this->mode = 'flat';
     }
     return $options;
 }