PluginProbe
WPGraphQL / 2.22.0
WPGraphQL v2.22.0
2.22.3 2.22.2 2.22.1 2.22.0 2.21.1 2.21.0 2.20.0 2.19.0 2.18.0 2.17.0 2.16.0 2.15.1 2.15.0 2.14.1 2.14.0 2.13.0 2.2.0 2.3.0 2.3.3 2.3.6 2.3.8 2.5.0 2.5.1 2.5.2 2.5.3 All 177 releases
wp-graphql / src / Type / ObjectType / Menu.php

Menu.php in WPGraphQL 2.22.0, at src/Type/ObjectType/Menu.php

77 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPGraphQL\Type\ObjectType;
4
5 use WPGraphQL\Model\Menu as MenuModel;
6
7 class Menu {
8
9 /**
10 * Register the Menu object type
11 *
12 * @return void
13 */
14 public static function register_type() {
15 register_graphql_object_type(
16 'Menu',
17 [
18 'description' => static function () {
19 return __( 'Collections of navigation links. Menus can be assigned to designated locations and used to build site navigation structures.', 'wp-graphql' );
20 },
21 'interfaces' => [ 'Node', 'DatabaseIdentifier' ],
22 'model' => MenuModel::class,
23 'fields' => static function () {
24 return [
25 'id' => [
26 'description' => static function () {
27 return __( 'The globally unique identifier of the nav menu object.', 'wp-graphql' );
28 },
29 ],
30 'count' => [
31 'type' => 'Int',
32 'description' => static function () {
33 return __( 'The number of items in the menu', 'wp-graphql' );
34 },
35 ],
36 'menuId' => [
37 'type' => 'Int',
38 'description' => static function () {
39 return __( 'WP ID of the nav menu.', 'wp-graphql' );
40 },
41 'deprecationReason' => static function () {
42 return __( 'Deprecated in favor of the databaseId field', 'wp-graphql' );
43 },
44 ],
45 'name' => [
46 'type' => 'String',
47 'description' => static function () {
48 return __( 'Display name of the menu.', 'wp-graphql' );
49 },
50 ],
51 'slug' => [
52 'type' => 'String',
53 'description' => static function () {
54 return __( 'The url friendly name of the menu.', 'wp-graphql' );
55 },
56 ],
57 'isRestricted' => [
58 'type' => 'Boolean',
59 'description' => static function () {
60 return __( 'Whether the object is restricted from the current viewer', 'wp-graphql' );
61 },
62 ],
63 'locations' => [
64 'type' => [
65 'list_of' => 'MenuLocationEnum',
66 ],
67 'description' => static function () {
68 return __( 'The locations a menu is assigned to', 'wp-graphql' );
69 },
70 ],
71 ];
72 },
73 ]
74 );
75 }
76 }
77