|
@@ 39-49 (lines=11) @@
|
| 36 |
|
} |
| 37 |
|
|
| 38 |
|
|
| 39 |
|
public function accept_entity( $request ) { |
| 40 |
|
$data = $request->get_params(); |
| 41 |
|
$term_id = (int) $data['term_id']; |
| 42 |
|
$entity_data = (array) $data['entity']; |
| 43 |
|
$entity = Entity_List_Factory::get_instance( $term_id ); |
| 44 |
|
$entity->save_jsonld_data( $entity_data ); |
| 45 |
|
update_term_meta( $term_id, self::IGNORE_TAG_FROM_LISTING, 1 ); |
| 46 |
|
Ttl_Cache::flush_all(); |
| 47 |
|
|
| 48 |
|
return $term_id; |
| 49 |
|
} |
| 50 |
|
|
| 51 |
|
public function undo( $request ) { |
| 52 |
|
$data = $request->get_params(); |
|
@@ 104-112 (lines=9) @@
|
| 101 |
|
$this->register_entity_accept_or_reject_route( $route, array( $this, 'reject_entity' ) ); |
| 102 |
|
} |
| 103 |
|
|
| 104 |
|
public function reject_entity( $request ) { |
| 105 |
|
$data = $request->get_params(); |
| 106 |
|
$term_id = (int) $data['term_id']; |
| 107 |
|
$entity_data = (array) $data['entity']; |
| 108 |
|
$entity = Entity_List_Factory::get_instance( $term_id ); |
| 109 |
|
$entity->remove_entity_by_id( $entity_data['@id'] ); |
| 110 |
|
Ttl_Cache::flush_all(); |
| 111 |
|
return $term_id; |
| 112 |
|
} |
| 113 |
|
|
| 114 |
|
private function register_nomatch_route() { |
| 115 |
|
register_rest_route( |