| @@ 322-336 (lines=15) @@ | ||
| 319 | * |
|
| 320 | * @return array |
|
| 321 | */ |
|
| 322 | public function fetch_association_options() { |
|
| 323 | $page = isset( $_GET['page'] ) ? absint( $_GET['page'] ) : 1; |
|
| 324 | $term = isset( $_GET['term'] ) ? sanitize_text_field( $_GET['term'] ) : ''; |
|
| 325 | ||
| 326 | $container_id = $_GET['container_id']; |
|
| 327 | $field_name = $_GET['field_name']; |
|
| 328 | ||
| 329 | /** @var \Carbon_Fields\Field\Association_Field $field */ |
|
| 330 | $field = Helper::get_field( null, $container_id, $field_name ); |
|
| 331 | ||
| 332 | return wp_send_json_success( $field->get_options( array( |
|
| 333 | 'page' => $page, |
|
| 334 | 'term' => $term, |
|
| 335 | ) ) ); |
|
| 336 | } |
|
| 337 | } |
|
| 338 | ||
| @@ 350-364 (lines=15) @@ | ||
| 347 | * |
|
| 348 | * @return array |
|
| 349 | */ |
|
| 350 | public function get_association_options() { |
|
| 351 | $page = isset( $_GET['page'] ) ? absint( $_GET['page'] ) : 1; |
|
| 352 | $term = isset( $_GET['term'] ) ? sanitize_text_field( $_GET['term'] ) : ''; |
|
| 353 | ||
| 354 | $container_id = $_GET['container_id']; |
|
| 355 | $field_id = $_GET['field_id']; |
|
| 356 | ||
| 357 | /** @var \Carbon_Fields\Field\Association_Field $field */ |
|
| 358 | $field = Helper::get_field( null, $container_id, $field_id ); |
|
| 359 | ||
| 360 | return $field->get_options( array( |
|
| 361 | 'page' => $page, |
|
| 362 | 'term' => $term, |
|
| 363 | ) ); |
|
| 364 | } |
|
| 365 | ||
| 366 | /** |
|
| 367 | * Get attachment data by given ID or URL. |
|