/** * If $load_data = true and $no_wp_data = true, will load only internal data (type and wp_id). * @param boolean $load_data * @param boolean $no_wp_data */ public function load_last_tree($load_data = false, $no_wp_data = false, $no_tree_state_data = false, $only_from_root = '') { $tree = ApmTreeDb::get_last_tree(); if (!empty($tree)) { $this->apm_tree = new ApmTree($tree); //For most treatments, we don't need the Wordpress data to be loaded. //The Wordpress infos are loaded just before display (see $this->get_ready_to_display_tree()). if ($load_data) { $this->nodes_data->load_multiple($this->apm_tree->get_nodes_flat($only_from_root), $no_wp_data); } if (!$no_tree_state_data) { //Load tree state from user meta data: $this->tree_state->load($this->apm_tree->get_nodes_flat()); if ($this->tree_state->is_empty() && empty($only_from_root)) { $this->tree_state->load_nodes($this->apm_tree->get_nodes_flat()); $this->save_tree_state(); } } } else { $this->reset_tree_and_data(); } }