Exemplo n.º 1
0
 /**
  * Fetches the records according to the query and the display mode.
  *
  * The method is overrode if the dispay mode is `tree` in which case the records are fetched
  * accroding to their relashion and the _expand_ state of their parent.
  */
 protected function fetch_records(Query $query)
 {
     global $core;
     if ($this->mode !== 'tree') {
         return parent::fetch_records($query);
     }
     $expanded = array_flip($this->options->expanded);
     return $query->model->blueprint($core->site_id)->subset(null, null, function (BlueprintNode $node) use($expanded) {
         return !(!$node->parentid || isset($expanded[$node->parentid]));
     })->ordered_records;
 }