/** * Sets a property for a given set of nodes. * Used for actions on list nodes or specific given nodes in a tree. * $_POST['property'] can be 'node_title', 'node_template' or 'node_marked' */ public static function nodes_set_nodes_property() { parent::$json_data += array('updated_nodes' => array()); if (!empty($_POST['nodes_to_update']) && is_array($_POST['nodes_to_update']) && isset($_POST['property']) && isset($_POST['value'])) { $nodes_to_update = $_POST['nodes_to_update']; $cascading_nodes = !empty($_POST['cascading_nodes']) ? $_POST['cascading_nodes'] : array(); $tree = new ApmTreeData(); //Load wp data because we already know it will only apply //to $nodes_to_update and not all nodes : $nodes_to_update = $tree->load_specific_nodes($nodes_to_update, $cascading_nodes); $tree->update_nodes_property($_POST['property'], $_POST['value']); $nodes_list = $tree->get_ready_to_display_nodes(); parent::$json_data['updated_nodes'] = $nodes_to_update; parent::$json_data['nodes_html'] = self::get_html_tree($nodes_list, true); parent::$json_data['property'] = $_POST['property']; parent::$json_data['value'] = $_POST['value']; } parent::send_json(); }