/** * */ public static function do_find_entity($entity_data) { $role_type = EntityRequestUtils::get_query_string_field('role'); if ($role_type) { return self::find_by_role($entity_data, $role_type); } return EntityAPI::do_find_entity($entity_data); }
/** * */ public static function find_child_entities_ajax() { if (!isset($_POST['artifact']) || !isset($_POST['parent_id']) || !isset($_POST['parent_field_name'])) { return array(); } $parent_id = EntityRequestUtils::get_query_string_field('parent_id'); $artifact_name = EntityRequestUtils::get_query_string_field('artifact'); $parent_field_name = EntityRequestUtils::get_query_string_field('parent_field_name'); $search_results = EntityAPI::find_by_criteria($artifact_name, array($parent_field_name => $parent_id)); ArtficatAjaxRequestProcessorUtils::do_after_ajax_find(EntityAPIUtils::init_entity_data($artifact_name), $search_results); }
/** * */ public static function do_before_ajax_delete() { // Ensure we have a valid form if (!isset($_POST['submitted']) && !isset($_POST['post_nonce_field']) && !wp_verify_nonce($_POST['post_nonce_field'], 'post_nonce')) { // Nounce field did not validate wp_send_json_error(array('message' => "Invalid form operation!")); } // Ensure we have a valid ID if (!isset($_POST['id'])) { wp_send_json_error(array('message' => "Entity identifier missing")); } $artifact_name = EntityRequestUtils::get_artifact_name(); $entity_data = EntityAPIUtils::init_entity_data($artifact_name); return $entity_data; }