ACFV1.php
3 years ago
CountLayoutInstall.php
3 years ago
ElImport.php
3 years ago
FrontEndFilterV1.php
3 years ago
GetPostsV1.php
3 years ago
ImageSizeV1.php
3 years ago
RestApi.php
3 years ago
RttpgV1.php
3 years ago
FrontEndFilterV1.php
30 lines
| 1 | <?php |
| 2 | |
| 3 | namespace RT\ThePostGrid\Controllers\Api; |
| 4 | |
| 5 | use RT\ThePostGrid\Helpers\Fns; |
| 6 | |
| 7 | class FrontEndFilterV1 { |
| 8 | public function __construct() { |
| 9 | add_action( "rest_api_init", [ $this, 'register_front_end_filter' ] ); |
| 10 | } |
| 11 | |
| 12 | public function register_front_end_filter() { |
| 13 | register_rest_route( 'rttpg/v1', 'filter', array( |
| 14 | 'methods' => 'POST', |
| 15 | 'callback' => [ $this, 'get_frontend_filter' ], |
| 16 | 'permission_callback' => function () { |
| 17 | return true; |
| 18 | } |
| 19 | ) ); |
| 20 | } |
| 21 | |
| 22 | public function get_frontend_filter( $data ) { |
| 23 | $data = Fns::get_frontend_filter_markup( $data, true ); |
| 24 | $filter_html = [ |
| 25 | 'markup' => $data |
| 26 | ]; |
| 27 | return rest_ensure_response( $filter_html ); |
| 28 | } |
| 29 | |
| 30 | } |