PluginProbe
Extendify / 3.2.2
Extendify v3.2.2
3.2.2 3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 All 128 releases
extendify / app / Agent / Controllers / SiteNavigationController.php

SiteNavigationController.php in Extendify 3.2.2, at app/Agent/Controllers/SiteNavigationController.php

38 lines 954 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Site Navigation Controller
5 */
6
7 namespace Extendify\Agent\Controllers;
8
9 /**
10 * Site Navigation Controller
11 */
12 class SiteNavigationController
13 {
14 /**
15 * Get a list of published navigation items from the site.
16 *
17 * @param \WP_REST_Request $request The REST API request
18 * @return \WP_REST_Response.
19 */
20 public static function getSiteNavigation($request): \WP_REST_Response
21 {
22 $navigation = get_posts([
23 'numberposts' => -1,
24 'post_status' => 'publish',
25 'post_type' => 'wp_navigation',
26 'include' => $request->get_param('only') ? explode(',', $request->get_param('only')) : []
27 ]);
28
29 return new \WP_REST_Response(array_map(function ($item) {
30 return [
31 "id" => $item->ID,
32 "name" => $item->post_title,
33 "content" => $item->post_content
34 ];
35 }, $navigation), 200);
36 }
37 }
38