@@ -28,71 +28,71 @@ |
||
28 | 28 | class RootQuery extends TypeBase |
29 | 29 | { |
30 | 30 | |
31 | - /** |
|
32 | - * RootQuery constructor. |
|
33 | - */ |
|
34 | - public function __construct() |
|
35 | - { |
|
36 | - $this->setName('RootQuery'); |
|
37 | - $this->setIsCustomPostType(true); |
|
38 | - parent::__construct(); |
|
39 | - } |
|
31 | + /** |
|
32 | + * RootQuery constructor. |
|
33 | + */ |
|
34 | + public function __construct() |
|
35 | + { |
|
36 | + $this->setName('RootQuery'); |
|
37 | + $this->setIsCustomPostType(true); |
|
38 | + parent::__construct(); |
|
39 | + } |
|
40 | 40 | |
41 | 41 | |
42 | - /** |
|
43 | - * @return GraphQLFieldInterface[] |
|
44 | - * @since $VID:$ |
|
45 | - */ |
|
46 | - public function getFields() |
|
47 | - { |
|
48 | - return [ |
|
49 | - new GraphQLOutputField( |
|
50 | - lcfirst($this->namespace) . 'EventRelations', |
|
51 | - 'String', |
|
52 | - null, |
|
53 | - esc_html__('JSON encoded relational data of the models', 'event_espresso'), |
|
54 | - null, |
|
55 | - [$this, 'getEventRelationalData'], |
|
56 | - [ |
|
57 | - 'eventId' => [ |
|
58 | - 'type' => ['non_null' => 'Int'], |
|
59 | - 'description' => esc_html__('The event ID to get the relational data for.', 'event_espresso'), |
|
60 | - ], |
|
61 | - ] |
|
62 | - ), |
|
63 | - ]; |
|
64 | - } |
|
42 | + /** |
|
43 | + * @return GraphQLFieldInterface[] |
|
44 | + * @since $VID:$ |
|
45 | + */ |
|
46 | + public function getFields() |
|
47 | + { |
|
48 | + return [ |
|
49 | + new GraphQLOutputField( |
|
50 | + lcfirst($this->namespace) . 'EventRelations', |
|
51 | + 'String', |
|
52 | + null, |
|
53 | + esc_html__('JSON encoded relational data of the models', 'event_espresso'), |
|
54 | + null, |
|
55 | + [$this, 'getEventRelationalData'], |
|
56 | + [ |
|
57 | + 'eventId' => [ |
|
58 | + 'type' => ['non_null' => 'Int'], |
|
59 | + 'description' => esc_html__('The event ID to get the relational data for.', 'event_espresso'), |
|
60 | + ], |
|
61 | + ] |
|
62 | + ), |
|
63 | + ]; |
|
64 | + } |
|
65 | 65 | |
66 | 66 | |
67 | - /** |
|
68 | - * @param mixed $source The source that's passed down the GraphQL queries |
|
69 | - * @param array $args The inputArgs on the field |
|
70 | - * @param AppContext $context The AppContext passed down the GraphQL tree |
|
71 | - * @param ResolveInfo $info The ResolveInfo passed down the GraphQL tree |
|
72 | - * @return string |
|
73 | - * @throws Exception |
|
74 | - * @throws InvalidArgumentException |
|
75 | - * @throws InvalidDataTypeException |
|
76 | - * @throws InvalidInterfaceException |
|
77 | - * @throws ReflectionException |
|
78 | - * @throws UserError |
|
79 | - * @throws UnexpectedEntityException |
|
80 | - * @since $VID:$ |
|
81 | - */ |
|
82 | - public function getEventRelationalData($source, array $args, AppContext $context, ResolveInfo $info) |
|
83 | - { |
|
84 | - /** |
|
85 | - * Throw an exception if there's no event ID |
|
86 | - */ |
|
87 | - if (empty($args['eventId']) || ! absint($args['eventId'])) { |
|
88 | - throw new UserError(esc_html__( |
|
89 | - 'No event ID was provided to get the relational data for', |
|
90 | - 'event_espresso' |
|
91 | - )); |
|
92 | - } |
|
67 | + /** |
|
68 | + * @param mixed $source The source that's passed down the GraphQL queries |
|
69 | + * @param array $args The inputArgs on the field |
|
70 | + * @param AppContext $context The AppContext passed down the GraphQL tree |
|
71 | + * @param ResolveInfo $info The ResolveInfo passed down the GraphQL tree |
|
72 | + * @return string |
|
73 | + * @throws Exception |
|
74 | + * @throws InvalidArgumentException |
|
75 | + * @throws InvalidDataTypeException |
|
76 | + * @throws InvalidInterfaceException |
|
77 | + * @throws ReflectionException |
|
78 | + * @throws UserError |
|
79 | + * @throws UnexpectedEntityException |
|
80 | + * @since $VID:$ |
|
81 | + */ |
|
82 | + public function getEventRelationalData($source, array $args, AppContext $context, ResolveInfo $info) |
|
83 | + { |
|
84 | + /** |
|
85 | + * Throw an exception if there's no event ID |
|
86 | + */ |
|
87 | + if (empty($args['eventId']) || ! absint($args['eventId'])) { |
|
88 | + throw new UserError(esc_html__( |
|
89 | + 'No event ID was provided to get the relational data for', |
|
90 | + 'event_espresso' |
|
91 | + )); |
|
92 | + } |
|
93 | 93 | |
94 | - $eventId = absint($args['eventId']); |
|
94 | + $eventId = absint($args['eventId']); |
|
95 | 95 | |
96 | - return json_encode(AdvancedEditorEntityData::getRelationalData($eventId)); |
|
97 | - } |
|
96 | + return json_encode(AdvancedEditorEntityData::getRelationalData($eventId)); |
|
97 | + } |
|
98 | 98 | } |
@@ -47,7 +47,7 @@ |
||
47 | 47 | { |
48 | 48 | return [ |
49 | 49 | new GraphQLOutputField( |
50 | - lcfirst($this->namespace) . 'EventRelations', |
|
50 | + lcfirst($this->namespace).'EventRelations', |
|
51 | 51 | 'String', |
52 | 52 | null, |
53 | 53 | esc_html__('JSON encoded relational data of the models', 'event_espresso'), |
@@ -22,100 +22,100 @@ |
||
22 | 22 | class PriceType extends TypeBase |
23 | 23 | { |
24 | 24 | |
25 | - /** |
|
26 | - * PriceType constructor. |
|
27 | - * |
|
28 | - * @param EEM_Price_Type $price_type_model |
|
29 | - */ |
|
30 | - public function __construct(EEM_Price_Type $price_type_model) |
|
31 | - { |
|
32 | - $this->model = $price_type_model; |
|
33 | - $this->setName($this->namespace. 'PriceType'); |
|
34 | - $this->setDescription(__('A price type.', 'event_espresso')); |
|
35 | - $this->setIsCustomPostType(false); |
|
36 | - parent::__construct(); |
|
37 | - } |
|
25 | + /** |
|
26 | + * PriceType constructor. |
|
27 | + * |
|
28 | + * @param EEM_Price_Type $price_type_model |
|
29 | + */ |
|
30 | + public function __construct(EEM_Price_Type $price_type_model) |
|
31 | + { |
|
32 | + $this->model = $price_type_model; |
|
33 | + $this->setName($this->namespace. 'PriceType'); |
|
34 | + $this->setDescription(__('A price type.', 'event_espresso')); |
|
35 | + $this->setIsCustomPostType(false); |
|
36 | + parent::__construct(); |
|
37 | + } |
|
38 | 38 | |
39 | 39 | |
40 | - /** |
|
41 | - * @return GraphQLFieldInterface[] |
|
42 | - * @since $VID:$ |
|
43 | - */ |
|
44 | - public function getFields() |
|
45 | - { |
|
46 | - return [ |
|
47 | - new GraphQLField( |
|
48 | - 'id', |
|
49 | - ['non_null' => 'ID'], |
|
50 | - null, |
|
51 | - esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
52 | - ), |
|
53 | - new GraphQLOutputField( |
|
54 | - 'dbId', |
|
55 | - ['non_null' => 'Int'], |
|
56 | - 'ID', |
|
57 | - esc_html__('Price type ID', 'event_espresso') |
|
58 | - ), |
|
59 | - new GraphQLField( |
|
60 | - 'baseType', |
|
61 | - $this->namespace . 'PriceBaseTypeEnum', |
|
62 | - 'base_type', |
|
63 | - esc_html__('Price Base type', 'event_espresso') |
|
64 | - ), |
|
65 | - new GraphQLField( |
|
66 | - 'isBasePrice', |
|
67 | - 'Boolean', |
|
68 | - 'is_base_price', |
|
69 | - esc_html__('Flag indicating price type is a base price.', 'event_espresso') |
|
70 | - ), |
|
71 | - new GraphQLField( |
|
72 | - 'isDeleted', |
|
73 | - 'Boolean', |
|
74 | - 'deleted', |
|
75 | - esc_html__('Flag indicating price type has been trashed.', 'event_espresso') |
|
76 | - ), |
|
77 | - new GraphQLOutputField( |
|
78 | - 'isDiscount', |
|
79 | - 'Boolean', |
|
80 | - 'is_discount', |
|
81 | - esc_html__('Flag indicating price type is a discount.', 'event_espresso') |
|
82 | - ), |
|
83 | - new GraphQLField( |
|
84 | - 'isPercent', |
|
85 | - 'Boolean', |
|
86 | - 'is_percent', |
|
87 | - esc_html__('Flag indicating price type is a percentage.', 'event_espresso') |
|
88 | - ), |
|
89 | - new GraphQLOutputField( |
|
90 | - 'isTax', |
|
91 | - 'Boolean', |
|
92 | - 'is_tax', |
|
93 | - esc_html__('Flag indicating price is a tax.', 'event_espresso') |
|
94 | - ), |
|
95 | - new GraphQLField( |
|
96 | - 'name', |
|
97 | - 'String', |
|
98 | - 'name', |
|
99 | - esc_html__('Price type Name', 'event_espresso') |
|
100 | - ), |
|
101 | - new GraphQLField( |
|
102 | - 'order', |
|
103 | - 'Int', |
|
104 | - 'order', |
|
105 | - esc_html__('Order in which price should be applied.', 'event_espresso') |
|
106 | - ), |
|
107 | - new GraphQLOutputField( |
|
108 | - 'wpUser', |
|
109 | - 'User', |
|
110 | - null, |
|
111 | - esc_html__('Price Type Creator', 'event_espresso') |
|
112 | - ), |
|
113 | - new GraphQLInputField( |
|
114 | - 'wpUser', |
|
115 | - 'Int', |
|
116 | - null, |
|
117 | - esc_html__('Price Type Creator ID', 'event_espresso') |
|
118 | - ), |
|
119 | - ]; |
|
120 | - } |
|
40 | + /** |
|
41 | + * @return GraphQLFieldInterface[] |
|
42 | + * @since $VID:$ |
|
43 | + */ |
|
44 | + public function getFields() |
|
45 | + { |
|
46 | + return [ |
|
47 | + new GraphQLField( |
|
48 | + 'id', |
|
49 | + ['non_null' => 'ID'], |
|
50 | + null, |
|
51 | + esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
52 | + ), |
|
53 | + new GraphQLOutputField( |
|
54 | + 'dbId', |
|
55 | + ['non_null' => 'Int'], |
|
56 | + 'ID', |
|
57 | + esc_html__('Price type ID', 'event_espresso') |
|
58 | + ), |
|
59 | + new GraphQLField( |
|
60 | + 'baseType', |
|
61 | + $this->namespace . 'PriceBaseTypeEnum', |
|
62 | + 'base_type', |
|
63 | + esc_html__('Price Base type', 'event_espresso') |
|
64 | + ), |
|
65 | + new GraphQLField( |
|
66 | + 'isBasePrice', |
|
67 | + 'Boolean', |
|
68 | + 'is_base_price', |
|
69 | + esc_html__('Flag indicating price type is a base price.', 'event_espresso') |
|
70 | + ), |
|
71 | + new GraphQLField( |
|
72 | + 'isDeleted', |
|
73 | + 'Boolean', |
|
74 | + 'deleted', |
|
75 | + esc_html__('Flag indicating price type has been trashed.', 'event_espresso') |
|
76 | + ), |
|
77 | + new GraphQLOutputField( |
|
78 | + 'isDiscount', |
|
79 | + 'Boolean', |
|
80 | + 'is_discount', |
|
81 | + esc_html__('Flag indicating price type is a discount.', 'event_espresso') |
|
82 | + ), |
|
83 | + new GraphQLField( |
|
84 | + 'isPercent', |
|
85 | + 'Boolean', |
|
86 | + 'is_percent', |
|
87 | + esc_html__('Flag indicating price type is a percentage.', 'event_espresso') |
|
88 | + ), |
|
89 | + new GraphQLOutputField( |
|
90 | + 'isTax', |
|
91 | + 'Boolean', |
|
92 | + 'is_tax', |
|
93 | + esc_html__('Flag indicating price is a tax.', 'event_espresso') |
|
94 | + ), |
|
95 | + new GraphQLField( |
|
96 | + 'name', |
|
97 | + 'String', |
|
98 | + 'name', |
|
99 | + esc_html__('Price type Name', 'event_espresso') |
|
100 | + ), |
|
101 | + new GraphQLField( |
|
102 | + 'order', |
|
103 | + 'Int', |
|
104 | + 'order', |
|
105 | + esc_html__('Order in which price should be applied.', 'event_espresso') |
|
106 | + ), |
|
107 | + new GraphQLOutputField( |
|
108 | + 'wpUser', |
|
109 | + 'User', |
|
110 | + null, |
|
111 | + esc_html__('Price Type Creator', 'event_espresso') |
|
112 | + ), |
|
113 | + new GraphQLInputField( |
|
114 | + 'wpUser', |
|
115 | + 'Int', |
|
116 | + null, |
|
117 | + esc_html__('Price Type Creator ID', 'event_espresso') |
|
118 | + ), |
|
119 | + ]; |
|
120 | + } |
|
121 | 121 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | public function __construct(EEM_Price_Type $price_type_model) |
31 | 31 | { |
32 | 32 | $this->model = $price_type_model; |
33 | - $this->setName($this->namespace. 'PriceType'); |
|
33 | + $this->setName($this->namespace.'PriceType'); |
|
34 | 34 | $this->setDescription(__('A price type.', 'event_espresso')); |
35 | 35 | $this->setIsCustomPostType(false); |
36 | 36 | parent::__construct(); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | ), |
59 | 59 | new GraphQLField( |
60 | 60 | 'baseType', |
61 | - $this->namespace . 'PriceBaseTypeEnum', |
|
61 | + $this->namespace.'PriceBaseTypeEnum', |
|
62 | 62 | 'base_type', |
63 | 63 | esc_html__('Price Base type', 'event_espresso') |
64 | 64 | ), |
@@ -25,237 +25,237 @@ |
||
25 | 25 | class Datetime extends TypeBase |
26 | 26 | { |
27 | 27 | |
28 | - /** |
|
29 | - * EventDate constructor. |
|
30 | - * |
|
31 | - * @param EEM_Datetime $datetime_model |
|
32 | - */ |
|
33 | - public function __construct(EEM_Datetime $datetime_model) |
|
34 | - { |
|
35 | - $this->model = $datetime_model; |
|
36 | - $this->setName($this->namespace . 'Datetime'); |
|
37 | - $this->setDescription(__('An event date', 'event_espresso')); |
|
38 | - $this->setIsCustomPostType(false); |
|
39 | - parent::__construct(); |
|
40 | - } |
|
28 | + /** |
|
29 | + * EventDate constructor. |
|
30 | + * |
|
31 | + * @param EEM_Datetime $datetime_model |
|
32 | + */ |
|
33 | + public function __construct(EEM_Datetime $datetime_model) |
|
34 | + { |
|
35 | + $this->model = $datetime_model; |
|
36 | + $this->setName($this->namespace . 'Datetime'); |
|
37 | + $this->setDescription(__('An event date', 'event_espresso')); |
|
38 | + $this->setIsCustomPostType(false); |
|
39 | + parent::__construct(); |
|
40 | + } |
|
41 | 41 | |
42 | 42 | |
43 | - /** |
|
44 | - * @return GraphQLFieldInterface[] |
|
45 | - * @since $VID:$ |
|
46 | - */ |
|
47 | - public function getFields() |
|
48 | - { |
|
49 | - return [ |
|
50 | - new GraphQLField( |
|
51 | - 'id', |
|
52 | - ['non_null' => 'ID'], |
|
53 | - null, |
|
54 | - esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
55 | - ), |
|
56 | - new GraphQLOutputField( |
|
57 | - 'dbId', |
|
58 | - ['non_null' => 'Int'], |
|
59 | - 'ID', |
|
60 | - esc_html__('The datetime ID.', 'event_espresso') |
|
61 | - ), |
|
62 | - new GraphQLField( |
|
63 | - 'name', |
|
64 | - 'String', |
|
65 | - 'name', |
|
66 | - esc_html__('Datetime Name', 'event_espresso') |
|
67 | - ), |
|
68 | - new GraphQLField( |
|
69 | - 'description', |
|
70 | - 'String', |
|
71 | - 'description', |
|
72 | - esc_html__('Description for Datetime', 'event_espresso') |
|
73 | - ), |
|
74 | - new GraphQLField( |
|
75 | - 'startDate', |
|
76 | - 'String', |
|
77 | - 'start_date_and_time', |
|
78 | - esc_html__('Start date and time of the Event', 'event_espresso'), |
|
79 | - [$this, 'formatDatetime'] |
|
80 | - ), |
|
81 | - new GraphQLField( |
|
82 | - 'endDate', |
|
83 | - 'String', |
|
84 | - 'end_date_and_time', |
|
85 | - esc_html__('End date and time of the Event', 'event_espresso'), |
|
86 | - [$this, 'formatDatetime'] |
|
87 | - ), |
|
88 | - new GraphQLField( |
|
89 | - 'capacity', |
|
90 | - 'Int', |
|
91 | - 'reg_limit', |
|
92 | - esc_html__('Registration Limit for this time', 'event_espresso'), |
|
93 | - [$this, 'parseInfiniteValue'] |
|
94 | - ), |
|
95 | - new GraphQLField( |
|
96 | - 'sold', |
|
97 | - 'Int', |
|
98 | - 'sold', |
|
99 | - esc_html__('How many sales for this Datetime that have occurred', 'event_espresso') |
|
100 | - ), |
|
101 | - new GraphQLField( |
|
102 | - 'reserved', |
|
103 | - 'Int', |
|
104 | - 'reserved', |
|
105 | - esc_html__('Quantity of tickets reserved, but not yet fully purchased', 'event_espresso') |
|
106 | - ), |
|
107 | - new GraphQLField( |
|
108 | - 'order', |
|
109 | - 'Int', |
|
110 | - 'order', |
|
111 | - esc_html__('The order in which the Datetime is displayed', 'event_espresso') |
|
112 | - ), |
|
113 | - new GraphQLField( |
|
114 | - 'length', |
|
115 | - 'Int', |
|
116 | - 'length', |
|
117 | - esc_html__('The length of the event (start to end time) in seconds', 'event_espresso') |
|
118 | - ), |
|
119 | - new GraphQLOutputField( |
|
120 | - 'parent', |
|
121 | - $this->name(), |
|
122 | - null, |
|
123 | - esc_html__('The parent datetime of the current datetime', 'event_espresso') |
|
124 | - ), |
|
125 | - new GraphQLInputField( |
|
126 | - 'parent', |
|
127 | - 'ID', |
|
128 | - null, |
|
129 | - esc_html__('The parent datetime ID', 'event_espresso') |
|
130 | - ), |
|
131 | - new GraphQLField( |
|
132 | - 'isPrimary', |
|
133 | - 'Boolean', |
|
134 | - 'is_primary', |
|
135 | - esc_html__('Flag indicating datetime is primary one for event', 'event_espresso') |
|
136 | - ), |
|
137 | - new GraphQLField( |
|
138 | - 'isSoldOut', |
|
139 | - 'Boolean', |
|
140 | - 'sold_out', |
|
141 | - esc_html__( |
|
142 | - 'Flag indicating whether the tickets sold for this datetime, met or exceed the registration limit', |
|
143 | - 'event_espresso' |
|
144 | - ) |
|
145 | - ), |
|
146 | - new GraphQLField( |
|
147 | - 'isUpcoming', |
|
148 | - 'Boolean', |
|
149 | - 'is_upcoming', |
|
150 | - esc_html__('Whether the date is upcoming', 'event_espresso') |
|
151 | - ), |
|
152 | - new GraphQLField( |
|
153 | - 'isActive', |
|
154 | - 'Boolean', |
|
155 | - 'is_active', |
|
156 | - esc_html__('Flag indicating datetime is active', 'event_espresso') |
|
157 | - ), |
|
158 | - new GraphQLField( |
|
159 | - 'isExpired', |
|
160 | - 'Boolean', |
|
161 | - 'is_expired', |
|
162 | - esc_html__('Flag indicating datetime is expired or not', 'event_espresso') |
|
163 | - ), |
|
164 | - new GraphQLOutputField( |
|
165 | - 'event', |
|
166 | - $this->namespace . 'Event', |
|
167 | - null, |
|
168 | - esc_html__('Event of the datetime.', 'event_espresso') |
|
169 | - ), |
|
170 | - new GraphQLInputField( |
|
171 | - 'eventId', |
|
172 | - 'Int', |
|
173 | - null, |
|
174 | - esc_html__('Event ID of the datetime.', 'event_espresso') |
|
175 | - ), |
|
176 | - new GraphQLInputField( |
|
177 | - 'event', |
|
178 | - 'ID', |
|
179 | - null, |
|
180 | - esc_html__('Globally unique event ID of the datetime.', 'event_espresso') |
|
181 | - ), |
|
182 | - new GraphQLInputField( |
|
183 | - 'tickets', |
|
184 | - ['list_of' => 'ID'], |
|
185 | - null, |
|
186 | - sprintf( |
|
187 | - '%1$s %2$s', |
|
188 | - esc_html__('Globally unique IDs of the tickets related to the datetime.', 'event_espresso'), |
|
189 | - esc_html__('Ignored if empty.', 'event_espresso') |
|
190 | - ) |
|
191 | - ), |
|
192 | - ]; |
|
193 | - } |
|
43 | + /** |
|
44 | + * @return GraphQLFieldInterface[] |
|
45 | + * @since $VID:$ |
|
46 | + */ |
|
47 | + public function getFields() |
|
48 | + { |
|
49 | + return [ |
|
50 | + new GraphQLField( |
|
51 | + 'id', |
|
52 | + ['non_null' => 'ID'], |
|
53 | + null, |
|
54 | + esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
55 | + ), |
|
56 | + new GraphQLOutputField( |
|
57 | + 'dbId', |
|
58 | + ['non_null' => 'Int'], |
|
59 | + 'ID', |
|
60 | + esc_html__('The datetime ID.', 'event_espresso') |
|
61 | + ), |
|
62 | + new GraphQLField( |
|
63 | + 'name', |
|
64 | + 'String', |
|
65 | + 'name', |
|
66 | + esc_html__('Datetime Name', 'event_espresso') |
|
67 | + ), |
|
68 | + new GraphQLField( |
|
69 | + 'description', |
|
70 | + 'String', |
|
71 | + 'description', |
|
72 | + esc_html__('Description for Datetime', 'event_espresso') |
|
73 | + ), |
|
74 | + new GraphQLField( |
|
75 | + 'startDate', |
|
76 | + 'String', |
|
77 | + 'start_date_and_time', |
|
78 | + esc_html__('Start date and time of the Event', 'event_espresso'), |
|
79 | + [$this, 'formatDatetime'] |
|
80 | + ), |
|
81 | + new GraphQLField( |
|
82 | + 'endDate', |
|
83 | + 'String', |
|
84 | + 'end_date_and_time', |
|
85 | + esc_html__('End date and time of the Event', 'event_espresso'), |
|
86 | + [$this, 'formatDatetime'] |
|
87 | + ), |
|
88 | + new GraphQLField( |
|
89 | + 'capacity', |
|
90 | + 'Int', |
|
91 | + 'reg_limit', |
|
92 | + esc_html__('Registration Limit for this time', 'event_espresso'), |
|
93 | + [$this, 'parseInfiniteValue'] |
|
94 | + ), |
|
95 | + new GraphQLField( |
|
96 | + 'sold', |
|
97 | + 'Int', |
|
98 | + 'sold', |
|
99 | + esc_html__('How many sales for this Datetime that have occurred', 'event_espresso') |
|
100 | + ), |
|
101 | + new GraphQLField( |
|
102 | + 'reserved', |
|
103 | + 'Int', |
|
104 | + 'reserved', |
|
105 | + esc_html__('Quantity of tickets reserved, but not yet fully purchased', 'event_espresso') |
|
106 | + ), |
|
107 | + new GraphQLField( |
|
108 | + 'order', |
|
109 | + 'Int', |
|
110 | + 'order', |
|
111 | + esc_html__('The order in which the Datetime is displayed', 'event_espresso') |
|
112 | + ), |
|
113 | + new GraphQLField( |
|
114 | + 'length', |
|
115 | + 'Int', |
|
116 | + 'length', |
|
117 | + esc_html__('The length of the event (start to end time) in seconds', 'event_espresso') |
|
118 | + ), |
|
119 | + new GraphQLOutputField( |
|
120 | + 'parent', |
|
121 | + $this->name(), |
|
122 | + null, |
|
123 | + esc_html__('The parent datetime of the current datetime', 'event_espresso') |
|
124 | + ), |
|
125 | + new GraphQLInputField( |
|
126 | + 'parent', |
|
127 | + 'ID', |
|
128 | + null, |
|
129 | + esc_html__('The parent datetime ID', 'event_espresso') |
|
130 | + ), |
|
131 | + new GraphQLField( |
|
132 | + 'isPrimary', |
|
133 | + 'Boolean', |
|
134 | + 'is_primary', |
|
135 | + esc_html__('Flag indicating datetime is primary one for event', 'event_espresso') |
|
136 | + ), |
|
137 | + new GraphQLField( |
|
138 | + 'isSoldOut', |
|
139 | + 'Boolean', |
|
140 | + 'sold_out', |
|
141 | + esc_html__( |
|
142 | + 'Flag indicating whether the tickets sold for this datetime, met or exceed the registration limit', |
|
143 | + 'event_espresso' |
|
144 | + ) |
|
145 | + ), |
|
146 | + new GraphQLField( |
|
147 | + 'isUpcoming', |
|
148 | + 'Boolean', |
|
149 | + 'is_upcoming', |
|
150 | + esc_html__('Whether the date is upcoming', 'event_espresso') |
|
151 | + ), |
|
152 | + new GraphQLField( |
|
153 | + 'isActive', |
|
154 | + 'Boolean', |
|
155 | + 'is_active', |
|
156 | + esc_html__('Flag indicating datetime is active', 'event_espresso') |
|
157 | + ), |
|
158 | + new GraphQLField( |
|
159 | + 'isExpired', |
|
160 | + 'Boolean', |
|
161 | + 'is_expired', |
|
162 | + esc_html__('Flag indicating datetime is expired or not', 'event_espresso') |
|
163 | + ), |
|
164 | + new GraphQLOutputField( |
|
165 | + 'event', |
|
166 | + $this->namespace . 'Event', |
|
167 | + null, |
|
168 | + esc_html__('Event of the datetime.', 'event_espresso') |
|
169 | + ), |
|
170 | + new GraphQLInputField( |
|
171 | + 'eventId', |
|
172 | + 'Int', |
|
173 | + null, |
|
174 | + esc_html__('Event ID of the datetime.', 'event_espresso') |
|
175 | + ), |
|
176 | + new GraphQLInputField( |
|
177 | + 'event', |
|
178 | + 'ID', |
|
179 | + null, |
|
180 | + esc_html__('Globally unique event ID of the datetime.', 'event_espresso') |
|
181 | + ), |
|
182 | + new GraphQLInputField( |
|
183 | + 'tickets', |
|
184 | + ['list_of' => 'ID'], |
|
185 | + null, |
|
186 | + sprintf( |
|
187 | + '%1$s %2$s', |
|
188 | + esc_html__('Globally unique IDs of the tickets related to the datetime.', 'event_espresso'), |
|
189 | + esc_html__('Ignored if empty.', 'event_espresso') |
|
190 | + ) |
|
191 | + ), |
|
192 | + ]; |
|
193 | + } |
|
194 | 194 | |
195 | 195 | |
196 | - /** |
|
197 | - * @param array $inputFields The mutation input fields. |
|
198 | - * @throws InvalidArgumentException |
|
199 | - * @throws ReflectionException |
|
200 | - * @since $VID:$ |
|
201 | - */ |
|
202 | - public function registerMutations(array $inputFields) |
|
203 | - { |
|
204 | - // Register mutation to update an entity. |
|
205 | - register_graphql_mutation( |
|
206 | - 'update' . $this->name(), |
|
207 | - [ |
|
208 | - 'inputFields' => $inputFields, |
|
209 | - 'outputFields' => [ |
|
210 | - lcfirst($this->name()) => [ |
|
211 | - 'type' => $this->name(), |
|
212 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
213 | - ], |
|
214 | - ], |
|
215 | - 'mutateAndGetPayload' => DatetimeUpdate::mutateAndGetPayload($this->model, $this), |
|
216 | - ] |
|
217 | - ); |
|
218 | - // Register mutation to delete an entity. |
|
219 | - register_graphql_mutation( |
|
220 | - 'delete' . $this->name(), |
|
221 | - [ |
|
222 | - 'inputFields' => [ |
|
223 | - 'id' => $inputFields['id'], |
|
224 | - 'deletePermanently' => [ |
|
225 | - 'type' => 'Boolean', |
|
226 | - 'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'), |
|
227 | - ], |
|
228 | - ], |
|
229 | - 'outputFields' => [ |
|
230 | - lcfirst($this->name()) => [ |
|
231 | - 'type' => $this->name(), |
|
232 | - 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
|
233 | - 'resolve' => static function ($payload) { |
|
234 | - $deleted = (object) $payload['deleted']; |
|
196 | + /** |
|
197 | + * @param array $inputFields The mutation input fields. |
|
198 | + * @throws InvalidArgumentException |
|
199 | + * @throws ReflectionException |
|
200 | + * @since $VID:$ |
|
201 | + */ |
|
202 | + public function registerMutations(array $inputFields) |
|
203 | + { |
|
204 | + // Register mutation to update an entity. |
|
205 | + register_graphql_mutation( |
|
206 | + 'update' . $this->name(), |
|
207 | + [ |
|
208 | + 'inputFields' => $inputFields, |
|
209 | + 'outputFields' => [ |
|
210 | + lcfirst($this->name()) => [ |
|
211 | + 'type' => $this->name(), |
|
212 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
213 | + ], |
|
214 | + ], |
|
215 | + 'mutateAndGetPayload' => DatetimeUpdate::mutateAndGetPayload($this->model, $this), |
|
216 | + ] |
|
217 | + ); |
|
218 | + // Register mutation to delete an entity. |
|
219 | + register_graphql_mutation( |
|
220 | + 'delete' . $this->name(), |
|
221 | + [ |
|
222 | + 'inputFields' => [ |
|
223 | + 'id' => $inputFields['id'], |
|
224 | + 'deletePermanently' => [ |
|
225 | + 'type' => 'Boolean', |
|
226 | + 'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'), |
|
227 | + ], |
|
228 | + ], |
|
229 | + 'outputFields' => [ |
|
230 | + lcfirst($this->name()) => [ |
|
231 | + 'type' => $this->name(), |
|
232 | + 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
|
233 | + 'resolve' => static function ($payload) { |
|
234 | + $deleted = (object) $payload['deleted']; |
|
235 | 235 | |
236 | - return ! empty($deleted) ? $deleted : null; |
|
237 | - }, |
|
238 | - ], |
|
239 | - ], |
|
240 | - 'mutateAndGetPayload' => DatetimeDelete::mutateAndGetPayload($this->model, $this), |
|
241 | - ] |
|
242 | - ); |
|
236 | + return ! empty($deleted) ? $deleted : null; |
|
237 | + }, |
|
238 | + ], |
|
239 | + ], |
|
240 | + 'mutateAndGetPayload' => DatetimeDelete::mutateAndGetPayload($this->model, $this), |
|
241 | + ] |
|
242 | + ); |
|
243 | 243 | |
244 | - // remove primary key from input. |
|
245 | - unset($inputFields['id']); |
|
246 | - // Register mutation to update an entity. |
|
247 | - register_graphql_mutation( |
|
248 | - 'create' . $this->name(), |
|
249 | - [ |
|
250 | - 'inputFields' => $inputFields, |
|
251 | - 'outputFields' => [ |
|
252 | - lcfirst($this->name()) => [ |
|
253 | - 'type' => $this->name(), |
|
254 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
255 | - ], |
|
256 | - ], |
|
257 | - 'mutateAndGetPayload' => DatetimeCreate::mutateAndGetPayload($this->model, $this), |
|
258 | - ] |
|
259 | - ); |
|
260 | - } |
|
244 | + // remove primary key from input. |
|
245 | + unset($inputFields['id']); |
|
246 | + // Register mutation to update an entity. |
|
247 | + register_graphql_mutation( |
|
248 | + 'create' . $this->name(), |
|
249 | + [ |
|
250 | + 'inputFields' => $inputFields, |
|
251 | + 'outputFields' => [ |
|
252 | + lcfirst($this->name()) => [ |
|
253 | + 'type' => $this->name(), |
|
254 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
255 | + ], |
|
256 | + ], |
|
257 | + 'mutateAndGetPayload' => DatetimeCreate::mutateAndGetPayload($this->model, $this), |
|
258 | + ] |
|
259 | + ); |
|
260 | + } |
|
261 | 261 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | public function __construct(EEM_Datetime $datetime_model) |
34 | 34 | { |
35 | 35 | $this->model = $datetime_model; |
36 | - $this->setName($this->namespace . 'Datetime'); |
|
36 | + $this->setName($this->namespace.'Datetime'); |
|
37 | 37 | $this->setDescription(__('An event date', 'event_espresso')); |
38 | 38 | $this->setIsCustomPostType(false); |
39 | 39 | parent::__construct(); |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | ), |
164 | 164 | new GraphQLOutputField( |
165 | 165 | 'event', |
166 | - $this->namespace . 'Event', |
|
166 | + $this->namespace.'Event', |
|
167 | 167 | null, |
168 | 168 | esc_html__('Event of the datetime.', 'event_espresso') |
169 | 169 | ), |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | { |
204 | 204 | // Register mutation to update an entity. |
205 | 205 | register_graphql_mutation( |
206 | - 'update' . $this->name(), |
|
206 | + 'update'.$this->name(), |
|
207 | 207 | [ |
208 | 208 | 'inputFields' => $inputFields, |
209 | 209 | 'outputFields' => [ |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | ); |
218 | 218 | // Register mutation to delete an entity. |
219 | 219 | register_graphql_mutation( |
220 | - 'delete' . $this->name(), |
|
220 | + 'delete'.$this->name(), |
|
221 | 221 | [ |
222 | 222 | 'inputFields' => [ |
223 | 223 | 'id' => $inputFields['id'], |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | lcfirst($this->name()) => [ |
231 | 231 | 'type' => $this->name(), |
232 | 232 | 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
233 | - 'resolve' => static function ($payload) { |
|
233 | + 'resolve' => static function($payload) { |
|
234 | 234 | $deleted = (object) $payload['deleted']; |
235 | 235 | |
236 | 236 | return ! empty($deleted) ? $deleted : null; |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | unset($inputFields['id']); |
246 | 246 | // Register mutation to update an entity. |
247 | 247 | register_graphql_mutation( |
248 | - 'create' . $this->name(), |
|
248 | + 'create'.$this->name(), |
|
249 | 249 | [ |
250 | 250 | 'inputFields' => $inputFields, |
251 | 251 | 'outputFields' => [ |
@@ -20,71 +20,71 @@ |
||
20 | 20 | class State extends TypeBase |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * State constructor. |
|
25 | - * |
|
26 | - * @param EEM_State $state_model |
|
27 | - */ |
|
28 | - public function __construct(EEM_State $state_model) |
|
29 | - { |
|
30 | - $this->model = $state_model; |
|
31 | - $this->setName($this->namespace . 'State'); |
|
32 | - $this->setDescription(__('A state', 'event_espresso')); |
|
33 | - $this->setIsCustomPostType(false); |
|
23 | + /** |
|
24 | + * State constructor. |
|
25 | + * |
|
26 | + * @param EEM_State $state_model |
|
27 | + */ |
|
28 | + public function __construct(EEM_State $state_model) |
|
29 | + { |
|
30 | + $this->model = $state_model; |
|
31 | + $this->setName($this->namespace . 'State'); |
|
32 | + $this->setDescription(__('A state', 'event_espresso')); |
|
33 | + $this->setIsCustomPostType(false); |
|
34 | 34 | |
35 | - parent::__construct(); |
|
36 | - } |
|
35 | + parent::__construct(); |
|
36 | + } |
|
37 | 37 | |
38 | 38 | |
39 | - /** |
|
40 | - * @return GraphQLFieldInterface[] |
|
41 | - * @since $VID:$ |
|
42 | - */ |
|
43 | - public function getFields() |
|
44 | - { |
|
45 | - return [ |
|
46 | - new GraphQLField( |
|
47 | - 'id', |
|
48 | - ['non_null' => 'ID'], |
|
49 | - null, |
|
50 | - esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
51 | - ), |
|
52 | - new GraphQLOutputField( |
|
53 | - 'dbId', |
|
54 | - ['non_null' => 'Int'], |
|
55 | - 'ID', |
|
56 | - esc_html__('State ID', 'event_espresso') |
|
57 | - ), |
|
58 | - new GraphQLField( |
|
59 | - 'abbreviation', |
|
60 | - 'String', |
|
61 | - 'abbrev', |
|
62 | - esc_html__('State Abbreviation', 'event_espresso') |
|
63 | - ), |
|
64 | - new GraphQLField( |
|
65 | - 'name', |
|
66 | - 'String', |
|
67 | - 'name', |
|
68 | - esc_html__('State Name', 'event_espresso') |
|
69 | - ), |
|
70 | - new GraphQLField( |
|
71 | - 'isActive', |
|
72 | - 'Boolean', |
|
73 | - 'active', |
|
74 | - esc_html__('State Active Flag', 'event_espresso') |
|
75 | - ), |
|
76 | - new GraphQLOutputField( |
|
77 | - 'country', |
|
78 | - $this->namespace . 'Country', |
|
79 | - null, |
|
80 | - esc_html__('Country for the state', 'event_espresso') |
|
81 | - ), |
|
82 | - new GraphQLInputField( |
|
83 | - 'country', |
|
84 | - 'String', |
|
85 | - null, |
|
86 | - esc_html__('Country ISO Code', 'event_espresso') |
|
87 | - ), |
|
88 | - ]; |
|
89 | - } |
|
39 | + /** |
|
40 | + * @return GraphQLFieldInterface[] |
|
41 | + * @since $VID:$ |
|
42 | + */ |
|
43 | + public function getFields() |
|
44 | + { |
|
45 | + return [ |
|
46 | + new GraphQLField( |
|
47 | + 'id', |
|
48 | + ['non_null' => 'ID'], |
|
49 | + null, |
|
50 | + esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
51 | + ), |
|
52 | + new GraphQLOutputField( |
|
53 | + 'dbId', |
|
54 | + ['non_null' => 'Int'], |
|
55 | + 'ID', |
|
56 | + esc_html__('State ID', 'event_espresso') |
|
57 | + ), |
|
58 | + new GraphQLField( |
|
59 | + 'abbreviation', |
|
60 | + 'String', |
|
61 | + 'abbrev', |
|
62 | + esc_html__('State Abbreviation', 'event_espresso') |
|
63 | + ), |
|
64 | + new GraphQLField( |
|
65 | + 'name', |
|
66 | + 'String', |
|
67 | + 'name', |
|
68 | + esc_html__('State Name', 'event_espresso') |
|
69 | + ), |
|
70 | + new GraphQLField( |
|
71 | + 'isActive', |
|
72 | + 'Boolean', |
|
73 | + 'active', |
|
74 | + esc_html__('State Active Flag', 'event_espresso') |
|
75 | + ), |
|
76 | + new GraphQLOutputField( |
|
77 | + 'country', |
|
78 | + $this->namespace . 'Country', |
|
79 | + null, |
|
80 | + esc_html__('Country for the state', 'event_espresso') |
|
81 | + ), |
|
82 | + new GraphQLInputField( |
|
83 | + 'country', |
|
84 | + 'String', |
|
85 | + null, |
|
86 | + esc_html__('Country ISO Code', 'event_espresso') |
|
87 | + ), |
|
88 | + ]; |
|
89 | + } |
|
90 | 90 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | public function __construct(EEM_State $state_model) |
29 | 29 | { |
30 | 30 | $this->model = $state_model; |
31 | - $this->setName($this->namespace . 'State'); |
|
31 | + $this->setName($this->namespace.'State'); |
|
32 | 32 | $this->setDescription(__('A state', 'event_espresso')); |
33 | 33 | $this->setIsCustomPostType(false); |
34 | 34 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | ), |
76 | 76 | new GraphQLOutputField( |
77 | 77 | 'country', |
78 | - $this->namespace . 'Country', |
|
78 | + $this->namespace.'Country', |
|
79 | 79 | null, |
80 | 80 | esc_html__('Country for the state', 'event_espresso') |
81 | 81 | ), |
@@ -18,109 +18,109 @@ |
||
18 | 18 | class Country extends TypeBase |
19 | 19 | { |
20 | 20 | |
21 | - /** |
|
22 | - * Country constructor. |
|
23 | - * |
|
24 | - * @param EEM_Country $country_model |
|
25 | - */ |
|
26 | - public function __construct(EEM_Country $country_model) |
|
27 | - { |
|
28 | - $this->model = $country_model; |
|
29 | - $this->setName($this->namespace . 'Country'); |
|
30 | - $this->setDescription(__('A country', 'event_espresso')); |
|
31 | - $this->setIsCustomPostType(false); |
|
32 | - parent::__construct(); |
|
33 | - } |
|
21 | + /** |
|
22 | + * Country constructor. |
|
23 | + * |
|
24 | + * @param EEM_Country $country_model |
|
25 | + */ |
|
26 | + public function __construct(EEM_Country $country_model) |
|
27 | + { |
|
28 | + $this->model = $country_model; |
|
29 | + $this->setName($this->namespace . 'Country'); |
|
30 | + $this->setDescription(__('A country', 'event_espresso')); |
|
31 | + $this->setIsCustomPostType(false); |
|
32 | + parent::__construct(); |
|
33 | + } |
|
34 | 34 | |
35 | 35 | |
36 | - /** |
|
37 | - * @return GraphQLFieldInterface[] |
|
38 | - * @since $VID:$ |
|
39 | - */ |
|
40 | - public function getFields() |
|
41 | - { |
|
42 | - return [ |
|
43 | - new GraphQLField( |
|
44 | - 'id', |
|
45 | - ['non_null' => 'ID'], |
|
46 | - null, |
|
47 | - esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
48 | - ), |
|
49 | - new GraphQLField( |
|
50 | - 'isActive', |
|
51 | - 'Boolean', |
|
52 | - null, // 'active', |
|
53 | - esc_html__( |
|
54 | - 'Flag that indicates if the country should appear in dropdown select lists', |
|
55 | - 'event_espresso' |
|
56 | - ) |
|
57 | - ), |
|
58 | - new GraphQLField( |
|
59 | - 'ISO', |
|
60 | - 'String', |
|
61 | - null, // 'ISO', |
|
62 | - esc_html__('Country ISO Code', 'event_espresso') |
|
63 | - ), |
|
64 | - new GraphQLField( |
|
65 | - 'ISO3', |
|
66 | - 'String', |
|
67 | - null, // 'ISO3', |
|
68 | - esc_html__('Country ISO3 Code', 'event_espresso') |
|
69 | - ), |
|
70 | - new GraphQLField( |
|
71 | - 'name', |
|
72 | - 'String', |
|
73 | - 'name', |
|
74 | - esc_html__('Country Name', 'event_espresso') |
|
75 | - ), |
|
76 | - new GraphQLField( |
|
77 | - 'currencyCode', |
|
78 | - 'String', |
|
79 | - 'currency_code', |
|
80 | - esc_html__('Country Currency Code', 'event_espresso') |
|
81 | - ), |
|
82 | - new GraphQLField( |
|
83 | - 'currencySingular', |
|
84 | - 'String', |
|
85 | - 'currency_name_single', |
|
86 | - esc_html__('Currency Name Singular', 'event_espresso') |
|
87 | - ), |
|
88 | - new GraphQLField( |
|
89 | - 'currencyPlural', |
|
90 | - 'String', |
|
91 | - 'currency_name_plural', |
|
92 | - esc_html__('Currency Name Plural', 'event_espresso') |
|
93 | - ), |
|
94 | - new GraphQLField( |
|
95 | - 'currencySign', |
|
96 | - 'String', |
|
97 | - 'currency_sign', |
|
98 | - __('Currency Sign', 'event_espresso') |
|
99 | - ), |
|
100 | - new GraphQLField( |
|
101 | - 'currencySignBeforeNumber', |
|
102 | - 'String', |
|
103 | - 'currency_sign_before', |
|
104 | - esc_html__('Currency Sign Before Number', 'event_espresso') |
|
105 | - ), |
|
106 | - new GraphQLField( |
|
107 | - 'currencyDecimalPlaces', |
|
108 | - 'String', |
|
109 | - 'currency_decimal_places', |
|
110 | - esc_html__('Currency Decimal Places', 'event_espresso') |
|
111 | - ), |
|
112 | - new GraphQLField( |
|
113 | - 'currencyDecimalMark', |
|
114 | - 'String', |
|
115 | - 'currency_decimal_mark', |
|
116 | - esc_html__('Currency Decimal Mark', 'event_espresso') |
|
117 | - ), |
|
118 | - new GraphQLField( |
|
119 | - 'currencyThousandsSeparator', |
|
120 | - 'String', |
|
121 | - 'currency_thousands_separator', |
|
122 | - esc_html__('Currency Thousands Separator', 'event_espresso') |
|
123 | - ), |
|
124 | - ]; |
|
125 | - } |
|
36 | + /** |
|
37 | + * @return GraphQLFieldInterface[] |
|
38 | + * @since $VID:$ |
|
39 | + */ |
|
40 | + public function getFields() |
|
41 | + { |
|
42 | + return [ |
|
43 | + new GraphQLField( |
|
44 | + 'id', |
|
45 | + ['non_null' => 'ID'], |
|
46 | + null, |
|
47 | + esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
48 | + ), |
|
49 | + new GraphQLField( |
|
50 | + 'isActive', |
|
51 | + 'Boolean', |
|
52 | + null, // 'active', |
|
53 | + esc_html__( |
|
54 | + 'Flag that indicates if the country should appear in dropdown select lists', |
|
55 | + 'event_espresso' |
|
56 | + ) |
|
57 | + ), |
|
58 | + new GraphQLField( |
|
59 | + 'ISO', |
|
60 | + 'String', |
|
61 | + null, // 'ISO', |
|
62 | + esc_html__('Country ISO Code', 'event_espresso') |
|
63 | + ), |
|
64 | + new GraphQLField( |
|
65 | + 'ISO3', |
|
66 | + 'String', |
|
67 | + null, // 'ISO3', |
|
68 | + esc_html__('Country ISO3 Code', 'event_espresso') |
|
69 | + ), |
|
70 | + new GraphQLField( |
|
71 | + 'name', |
|
72 | + 'String', |
|
73 | + 'name', |
|
74 | + esc_html__('Country Name', 'event_espresso') |
|
75 | + ), |
|
76 | + new GraphQLField( |
|
77 | + 'currencyCode', |
|
78 | + 'String', |
|
79 | + 'currency_code', |
|
80 | + esc_html__('Country Currency Code', 'event_espresso') |
|
81 | + ), |
|
82 | + new GraphQLField( |
|
83 | + 'currencySingular', |
|
84 | + 'String', |
|
85 | + 'currency_name_single', |
|
86 | + esc_html__('Currency Name Singular', 'event_espresso') |
|
87 | + ), |
|
88 | + new GraphQLField( |
|
89 | + 'currencyPlural', |
|
90 | + 'String', |
|
91 | + 'currency_name_plural', |
|
92 | + esc_html__('Currency Name Plural', 'event_espresso') |
|
93 | + ), |
|
94 | + new GraphQLField( |
|
95 | + 'currencySign', |
|
96 | + 'String', |
|
97 | + 'currency_sign', |
|
98 | + __('Currency Sign', 'event_espresso') |
|
99 | + ), |
|
100 | + new GraphQLField( |
|
101 | + 'currencySignBeforeNumber', |
|
102 | + 'String', |
|
103 | + 'currency_sign_before', |
|
104 | + esc_html__('Currency Sign Before Number', 'event_espresso') |
|
105 | + ), |
|
106 | + new GraphQLField( |
|
107 | + 'currencyDecimalPlaces', |
|
108 | + 'String', |
|
109 | + 'currency_decimal_places', |
|
110 | + esc_html__('Currency Decimal Places', 'event_espresso') |
|
111 | + ), |
|
112 | + new GraphQLField( |
|
113 | + 'currencyDecimalMark', |
|
114 | + 'String', |
|
115 | + 'currency_decimal_mark', |
|
116 | + esc_html__('Currency Decimal Mark', 'event_espresso') |
|
117 | + ), |
|
118 | + new GraphQLField( |
|
119 | + 'currencyThousandsSeparator', |
|
120 | + 'String', |
|
121 | + 'currency_thousands_separator', |
|
122 | + esc_html__('Currency Thousands Separator', 'event_espresso') |
|
123 | + ), |
|
124 | + ]; |
|
125 | + } |
|
126 | 126 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | public function __construct(EEM_Country $country_model) |
27 | 27 | { |
28 | 28 | $this->model = $country_model; |
29 | - $this->setName($this->namespace . 'Country'); |
|
29 | + $this->setName($this->namespace.'Country'); |
|
30 | 30 | $this->setDescription(__('A country', 'event_espresso')); |
31 | 31 | $this->setIsCustomPostType(false); |
32 | 32 | parent::__construct(); |
@@ -17,298 +17,298 @@ |
||
17 | 17 | class CustomPostTypeDefinitions |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * @var string $namespace The graphql namespace/prefix. |
|
22 | - */ |
|
23 | - protected $namespace = 'Espresso'; |
|
20 | + /** |
|
21 | + * @var string $namespace The graphql namespace/prefix. |
|
22 | + */ |
|
23 | + protected $namespace = 'Espresso'; |
|
24 | 24 | |
25 | - /** |
|
26 | - * @var EE_Core_Config |
|
27 | - */ |
|
28 | - public $core_config; |
|
25 | + /** |
|
26 | + * @var EE_Core_Config |
|
27 | + */ |
|
28 | + public $core_config; |
|
29 | 29 | |
30 | - /** |
|
31 | - * @var array $custom_post_types |
|
32 | - */ |
|
33 | - private $custom_post_types; |
|
30 | + /** |
|
31 | + * @var array $custom_post_types |
|
32 | + */ |
|
33 | + private $custom_post_types; |
|
34 | 34 | |
35 | - /** |
|
36 | - * @var LoaderInterface $loader |
|
37 | - */ |
|
38 | - private $loader; |
|
35 | + /** |
|
36 | + * @var LoaderInterface $loader |
|
37 | + */ |
|
38 | + private $loader; |
|
39 | 39 | |
40 | 40 | |
41 | - /** |
|
42 | - * EspressoCustomPostTypeDefinitions constructor. |
|
43 | - * |
|
44 | - * @param EE_Core_Config $core_config |
|
45 | - * @param LoaderInterface $loader |
|
46 | - */ |
|
47 | - public function __construct(EE_Core_Config $core_config, LoaderInterface $loader) |
|
48 | - { |
|
49 | - $this->core_config = $core_config; |
|
50 | - $this->loader = $loader; |
|
51 | - $this->setDefinitions(); |
|
52 | - } |
|
41 | + /** |
|
42 | + * EspressoCustomPostTypeDefinitions constructor. |
|
43 | + * |
|
44 | + * @param EE_Core_Config $core_config |
|
45 | + * @param LoaderInterface $loader |
|
46 | + */ |
|
47 | + public function __construct(EE_Core_Config $core_config, LoaderInterface $loader) |
|
48 | + { |
|
49 | + $this->core_config = $core_config; |
|
50 | + $this->loader = $loader; |
|
51 | + $this->setDefinitions(); |
|
52 | + } |
|
53 | 53 | |
54 | 54 | |
55 | - /** |
|
56 | - * defines Espresso Custom Post Types |
|
57 | - * NOTE the ['args']['page_templates'] array index is something specific to our CPTs |
|
58 | - * and not part of the WP custom post type api. |
|
59 | - * |
|
60 | - * @return void |
|
61 | - */ |
|
62 | - private function setDefinitions() |
|
63 | - { |
|
64 | - $this->custom_post_types = [ |
|
65 | - 'espresso_events' => [ |
|
66 | - 'singular_name' => esc_html__('Event', 'event_espresso'), |
|
67 | - 'plural_name' => esc_html__('Events', 'event_espresso'), |
|
68 | - 'singular_slug' => esc_html__('event', 'event_espresso'), |
|
69 | - 'plural_slug' => $this->core_config->event_cpt_slug, |
|
70 | - 'class_name' => 'EE_Event', |
|
71 | - 'model_name' => 'EEM_Event', |
|
72 | - 'args' => [ |
|
73 | - 'public' => true, |
|
74 | - 'show_in_nav_menus' => true, |
|
75 | - 'show_in_graphql' => true, |
|
76 | - 'graphql_single_name' => $this->namespace . 'Event', |
|
77 | - 'graphql_plural_name' => $this->namespace . 'Events', |
|
78 | - 'capability_type' => 'event', |
|
79 | - 'capabilities' => [ |
|
80 | - 'edit_post' => 'ee_edit_event', |
|
81 | - 'read_post' => 'ee_read_event', |
|
82 | - 'delete_post' => 'ee_delete_event', |
|
83 | - 'edit_posts' => 'ee_edit_events', |
|
84 | - 'edit_others_posts' => 'ee_edit_others_events', |
|
85 | - 'publish_posts' => 'ee_publish_events', |
|
86 | - 'read_private_posts' => 'ee_read_private_events', |
|
87 | - 'delete_posts' => 'ee_delete_events', |
|
88 | - 'delete_private_posts' => 'ee_delete_private_events', |
|
89 | - 'delete_published_posts' => 'ee_delete_published_events', |
|
90 | - 'delete_others_posts' => 'ee_delete_others_events', |
|
91 | - 'edit_private_posts' => 'ee_edit_private_events', |
|
92 | - 'edit_published_posts' => 'ee_edit_published_events', |
|
93 | - ], |
|
94 | - 'taxonomies' => [ |
|
95 | - 'espresso_event_categories', |
|
96 | - 'espresso_event_type', |
|
97 | - 'post_tag', |
|
98 | - ], |
|
99 | - 'page_templates' => true, |
|
100 | - ], |
|
101 | - ], |
|
102 | - 'espresso_venues' => [ |
|
103 | - 'singular_name' => esc_html__('Venue', 'event_espresso'), |
|
104 | - 'plural_name' => esc_html__('Venues', 'event_espresso'), |
|
105 | - 'singular_slug' => esc_html__('venue', 'event_espresso'), |
|
106 | - 'plural_slug' => esc_html__('venues', 'event_espresso'), |
|
107 | - 'class_name' => 'EE_Venue', |
|
108 | - 'model_name' => 'EEM_Venue', |
|
109 | - 'args' => [ |
|
110 | - 'public' => true, |
|
111 | - 'show_in_nav_menus' => false, // by default this doesn't show for decaf, |
|
112 | - 'show_in_graphql' => true, |
|
113 | - 'graphql_single_name' => $this->namespace . 'Venue', |
|
114 | - 'graphql_plural_name' => $this->namespace . 'Venues', |
|
115 | - 'capability_type' => 'venue', |
|
116 | - 'capabilities' => [ |
|
117 | - 'edit_post' => 'ee_edit_venue', |
|
118 | - 'read_post' => 'ee_read_venue', |
|
119 | - 'delete_post' => 'ee_delete_venue', |
|
120 | - 'edit_posts' => 'ee_edit_venues', |
|
121 | - 'edit_others_posts' => 'ee_edit_others_venues', |
|
122 | - 'publish_posts' => 'ee_publish_venues', |
|
123 | - 'read_private_posts' => 'ee_read_private_venues', |
|
124 | - 'delete_posts' => 'ee_delete_venues', |
|
125 | - 'delete_private_posts' => 'ee_delete_private_venues', |
|
126 | - 'delete_published_posts' => 'ee_delete_published_venues', |
|
127 | - 'delete_others_posts' => 'ee_edit_others_venues', |
|
128 | - 'edit_private_posts' => 'ee_edit_private_venues', |
|
129 | - 'edit_published_posts' => 'ee_edit_published_venues', |
|
130 | - ], |
|
131 | - 'taxonomies' => [ |
|
132 | - 'espresso_venue_categories', |
|
133 | - 'post_tag', |
|
134 | - ], |
|
135 | - 'page_templates' => true, |
|
136 | - ], |
|
137 | - ], |
|
138 | - 'espresso_attendees' => [ |
|
139 | - 'singular_name' => esc_html__('Contact', 'event_espresso'), |
|
140 | - 'plural_name' => esc_html__('Contacts', 'event_espresso'), |
|
141 | - 'singular_slug' => esc_html__('contact', 'event_espresso'), |
|
142 | - 'plural_slug' => esc_html__('contacts', 'event_espresso'), |
|
143 | - 'class_name' => 'EE_Attendee', |
|
144 | - 'model_name' => 'EEM_Attendee', |
|
145 | - 'args' => [ |
|
146 | - 'public' => false, |
|
147 | - 'publicly_queryable' => false, |
|
148 | - 'hierarchical' => false, |
|
149 | - 'has_archive' => false, |
|
150 | - 'supports' => [ |
|
151 | - 'editor', |
|
152 | - 'thumbnail', |
|
153 | - 'excerpt', |
|
154 | - 'custom-fields', |
|
155 | - 'comments', |
|
156 | - ], |
|
157 | - 'taxonomies' => ['post_tag'], |
|
158 | - 'capability_type' => 'contact', |
|
159 | - 'capabilities' => [ |
|
160 | - 'edit_post' => 'ee_edit_contact', |
|
161 | - 'read_post' => 'ee_read_contact', |
|
162 | - 'delete_post' => 'ee_delete_contact', |
|
163 | - 'edit_posts' => 'ee_edit_contacts', |
|
164 | - 'edit_others_posts' => 'ee_edit_contacts', |
|
165 | - 'publish_posts' => 'ee_edit_contacts', |
|
166 | - 'read_private_posts' => 'ee_edit_contacts', |
|
167 | - 'delete_posts' => 'ee_delete_contacts', |
|
168 | - 'delete_private_posts' => 'ee_delete_contacts', |
|
169 | - 'delete_published_posts' => 'ee_delete_contacts', |
|
170 | - 'delete_others_posts' => 'ee_delete_contacts', |
|
171 | - 'edit_private_posts' => 'ee_edit_contacts', |
|
172 | - 'edit_published_posts' => 'ee_edit_contacts', |
|
173 | - ], |
|
174 | - ], |
|
175 | - ], |
|
176 | - ]; |
|
177 | - } |
|
55 | + /** |
|
56 | + * defines Espresso Custom Post Types |
|
57 | + * NOTE the ['args']['page_templates'] array index is something specific to our CPTs |
|
58 | + * and not part of the WP custom post type api. |
|
59 | + * |
|
60 | + * @return void |
|
61 | + */ |
|
62 | + private function setDefinitions() |
|
63 | + { |
|
64 | + $this->custom_post_types = [ |
|
65 | + 'espresso_events' => [ |
|
66 | + 'singular_name' => esc_html__('Event', 'event_espresso'), |
|
67 | + 'plural_name' => esc_html__('Events', 'event_espresso'), |
|
68 | + 'singular_slug' => esc_html__('event', 'event_espresso'), |
|
69 | + 'plural_slug' => $this->core_config->event_cpt_slug, |
|
70 | + 'class_name' => 'EE_Event', |
|
71 | + 'model_name' => 'EEM_Event', |
|
72 | + 'args' => [ |
|
73 | + 'public' => true, |
|
74 | + 'show_in_nav_menus' => true, |
|
75 | + 'show_in_graphql' => true, |
|
76 | + 'graphql_single_name' => $this->namespace . 'Event', |
|
77 | + 'graphql_plural_name' => $this->namespace . 'Events', |
|
78 | + 'capability_type' => 'event', |
|
79 | + 'capabilities' => [ |
|
80 | + 'edit_post' => 'ee_edit_event', |
|
81 | + 'read_post' => 'ee_read_event', |
|
82 | + 'delete_post' => 'ee_delete_event', |
|
83 | + 'edit_posts' => 'ee_edit_events', |
|
84 | + 'edit_others_posts' => 'ee_edit_others_events', |
|
85 | + 'publish_posts' => 'ee_publish_events', |
|
86 | + 'read_private_posts' => 'ee_read_private_events', |
|
87 | + 'delete_posts' => 'ee_delete_events', |
|
88 | + 'delete_private_posts' => 'ee_delete_private_events', |
|
89 | + 'delete_published_posts' => 'ee_delete_published_events', |
|
90 | + 'delete_others_posts' => 'ee_delete_others_events', |
|
91 | + 'edit_private_posts' => 'ee_edit_private_events', |
|
92 | + 'edit_published_posts' => 'ee_edit_published_events', |
|
93 | + ], |
|
94 | + 'taxonomies' => [ |
|
95 | + 'espresso_event_categories', |
|
96 | + 'espresso_event_type', |
|
97 | + 'post_tag', |
|
98 | + ], |
|
99 | + 'page_templates' => true, |
|
100 | + ], |
|
101 | + ], |
|
102 | + 'espresso_venues' => [ |
|
103 | + 'singular_name' => esc_html__('Venue', 'event_espresso'), |
|
104 | + 'plural_name' => esc_html__('Venues', 'event_espresso'), |
|
105 | + 'singular_slug' => esc_html__('venue', 'event_espresso'), |
|
106 | + 'plural_slug' => esc_html__('venues', 'event_espresso'), |
|
107 | + 'class_name' => 'EE_Venue', |
|
108 | + 'model_name' => 'EEM_Venue', |
|
109 | + 'args' => [ |
|
110 | + 'public' => true, |
|
111 | + 'show_in_nav_menus' => false, // by default this doesn't show for decaf, |
|
112 | + 'show_in_graphql' => true, |
|
113 | + 'graphql_single_name' => $this->namespace . 'Venue', |
|
114 | + 'graphql_plural_name' => $this->namespace . 'Venues', |
|
115 | + 'capability_type' => 'venue', |
|
116 | + 'capabilities' => [ |
|
117 | + 'edit_post' => 'ee_edit_venue', |
|
118 | + 'read_post' => 'ee_read_venue', |
|
119 | + 'delete_post' => 'ee_delete_venue', |
|
120 | + 'edit_posts' => 'ee_edit_venues', |
|
121 | + 'edit_others_posts' => 'ee_edit_others_venues', |
|
122 | + 'publish_posts' => 'ee_publish_venues', |
|
123 | + 'read_private_posts' => 'ee_read_private_venues', |
|
124 | + 'delete_posts' => 'ee_delete_venues', |
|
125 | + 'delete_private_posts' => 'ee_delete_private_venues', |
|
126 | + 'delete_published_posts' => 'ee_delete_published_venues', |
|
127 | + 'delete_others_posts' => 'ee_edit_others_venues', |
|
128 | + 'edit_private_posts' => 'ee_edit_private_venues', |
|
129 | + 'edit_published_posts' => 'ee_edit_published_venues', |
|
130 | + ], |
|
131 | + 'taxonomies' => [ |
|
132 | + 'espresso_venue_categories', |
|
133 | + 'post_tag', |
|
134 | + ], |
|
135 | + 'page_templates' => true, |
|
136 | + ], |
|
137 | + ], |
|
138 | + 'espresso_attendees' => [ |
|
139 | + 'singular_name' => esc_html__('Contact', 'event_espresso'), |
|
140 | + 'plural_name' => esc_html__('Contacts', 'event_espresso'), |
|
141 | + 'singular_slug' => esc_html__('contact', 'event_espresso'), |
|
142 | + 'plural_slug' => esc_html__('contacts', 'event_espresso'), |
|
143 | + 'class_name' => 'EE_Attendee', |
|
144 | + 'model_name' => 'EEM_Attendee', |
|
145 | + 'args' => [ |
|
146 | + 'public' => false, |
|
147 | + 'publicly_queryable' => false, |
|
148 | + 'hierarchical' => false, |
|
149 | + 'has_archive' => false, |
|
150 | + 'supports' => [ |
|
151 | + 'editor', |
|
152 | + 'thumbnail', |
|
153 | + 'excerpt', |
|
154 | + 'custom-fields', |
|
155 | + 'comments', |
|
156 | + ], |
|
157 | + 'taxonomies' => ['post_tag'], |
|
158 | + 'capability_type' => 'contact', |
|
159 | + 'capabilities' => [ |
|
160 | + 'edit_post' => 'ee_edit_contact', |
|
161 | + 'read_post' => 'ee_read_contact', |
|
162 | + 'delete_post' => 'ee_delete_contact', |
|
163 | + 'edit_posts' => 'ee_edit_contacts', |
|
164 | + 'edit_others_posts' => 'ee_edit_contacts', |
|
165 | + 'publish_posts' => 'ee_edit_contacts', |
|
166 | + 'read_private_posts' => 'ee_edit_contacts', |
|
167 | + 'delete_posts' => 'ee_delete_contacts', |
|
168 | + 'delete_private_posts' => 'ee_delete_contacts', |
|
169 | + 'delete_published_posts' => 'ee_delete_contacts', |
|
170 | + 'delete_others_posts' => 'ee_delete_contacts', |
|
171 | + 'edit_private_posts' => 'ee_edit_contacts', |
|
172 | + 'edit_published_posts' => 'ee_edit_contacts', |
|
173 | + ], |
|
174 | + ], |
|
175 | + ], |
|
176 | + ]; |
|
177 | + } |
|
178 | 178 | |
179 | 179 | |
180 | - /** |
|
181 | - * @return array |
|
182 | - */ |
|
183 | - public function getDefinitions() |
|
184 | - { |
|
185 | - return (array) apply_filters( |
|
186 | - 'FHEE__EventEspresso_core_domain_entities_custom_post_types_CustomPostTypeDefinitions__getCustomPostTypes', |
|
187 | - // legacy filter applied for now, |
|
188 | - // later on we'll run a has_filter($tag) check and throw a doing_it_wrong() notice |
|
189 | - apply_filters( |
|
190 | - 'FHEE__EE_Register_CPTs__get_CPTs__cpts', |
|
191 | - $this->custom_post_types |
|
192 | - ) |
|
193 | - ); |
|
194 | - } |
|
180 | + /** |
|
181 | + * @return array |
|
182 | + */ |
|
183 | + public function getDefinitions() |
|
184 | + { |
|
185 | + return (array) apply_filters( |
|
186 | + 'FHEE__EventEspresso_core_domain_entities_custom_post_types_CustomPostTypeDefinitions__getCustomPostTypes', |
|
187 | + // legacy filter applied for now, |
|
188 | + // later on we'll run a has_filter($tag) check and throw a doing_it_wrong() notice |
|
189 | + apply_filters( |
|
190 | + 'FHEE__EE_Register_CPTs__get_CPTs__cpts', |
|
191 | + $this->custom_post_types |
|
192 | + ) |
|
193 | + ); |
|
194 | + } |
|
195 | 195 | |
196 | 196 | |
197 | - /** |
|
198 | - * @return array |
|
199 | - */ |
|
200 | - public function getCustomPostTypeSlugs() |
|
201 | - { |
|
202 | - return array_keys($this->getDefinitions()); |
|
203 | - } |
|
197 | + /** |
|
198 | + * @return array |
|
199 | + */ |
|
200 | + public function getCustomPostTypeSlugs() |
|
201 | + { |
|
202 | + return array_keys($this->getDefinitions()); |
|
203 | + } |
|
204 | 204 | |
205 | 205 | |
206 | - /** |
|
207 | - * This basically goes through the CPT array and returns only CPT's |
|
208 | - * that have the ['args']['public'] option set as false |
|
209 | - * |
|
210 | - * @return array |
|
211 | - */ |
|
212 | - public function getPrivateCustomPostTypes() |
|
213 | - { |
|
214 | - $private_CPTs = []; |
|
215 | - foreach ($this->getDefinitions() as $CPT => $details) { |
|
216 | - if (empty($details['args']['public'])) { |
|
217 | - $private_CPTs[ $CPT ] = $details; |
|
218 | - } |
|
219 | - } |
|
220 | - return $private_CPTs; |
|
221 | - } |
|
206 | + /** |
|
207 | + * This basically goes through the CPT array and returns only CPT's |
|
208 | + * that have the ['args']['public'] option set as false |
|
209 | + * |
|
210 | + * @return array |
|
211 | + */ |
|
212 | + public function getPrivateCustomPostTypes() |
|
213 | + { |
|
214 | + $private_CPTs = []; |
|
215 | + foreach ($this->getDefinitions() as $CPT => $details) { |
|
216 | + if (empty($details['args']['public'])) { |
|
217 | + $private_CPTs[ $CPT ] = $details; |
|
218 | + } |
|
219 | + } |
|
220 | + return $private_CPTs; |
|
221 | + } |
|
222 | 222 | |
223 | 223 | |
224 | - /** |
|
225 | - * This returns the corresponding model name for cpts registered by EE. |
|
226 | - * |
|
227 | - * @param string $post_type_slug If a slug is included, then attempt to retrieve |
|
228 | - * the model name for the given cpt slug. |
|
229 | - * Otherwise if empty, then we'll return |
|
230 | - * all cpt model names for cpts registered in EE. |
|
231 | - * @return array Empty array if no matching model names for the given slug |
|
232 | - * or an array of model names indexed by post type slug. |
|
233 | - */ |
|
234 | - public function getCustomPostTypeModelNames($post_type_slug = '') |
|
235 | - { |
|
236 | - $cpts = $this->getDefinitions(); |
|
237 | - // first if slug passed in... |
|
238 | - if (! empty($post_type_slug)) { |
|
239 | - // check that slug and cpt match |
|
240 | - if (! isset($cpts[ $post_type_slug ])) { |
|
241 | - return []; |
|
242 | - } |
|
243 | - if (empty($cpts[ $post_type_slug ]['class_name']) |
|
244 | - && empty($cpts[ $post_type_slug ]['model_name']) |
|
245 | - ) { |
|
246 | - return []; |
|
247 | - } |
|
248 | - // k let's get the model name for this cpt. |
|
249 | - return $this->getCustomPostTypeModelName($post_type_slug, $cpts[ $post_type_slug ]); |
|
250 | - } |
|
251 | - // if we made it here then we're returning an array of cpt model names indexed by post_type_slug. |
|
252 | - $cpt_models = []; |
|
253 | - foreach ($cpts as $slug => $args) { |
|
254 | - $model = $this->getCustomPostTypeModelName($post_type_slug, $cpts[ $post_type_slug ]); |
|
255 | - if (! empty($model)) { |
|
256 | - $cpt_models[ $slug ] = $model; |
|
257 | - } |
|
258 | - } |
|
259 | - return $cpt_models; |
|
260 | - } |
|
224 | + /** |
|
225 | + * This returns the corresponding model name for cpts registered by EE. |
|
226 | + * |
|
227 | + * @param string $post_type_slug If a slug is included, then attempt to retrieve |
|
228 | + * the model name for the given cpt slug. |
|
229 | + * Otherwise if empty, then we'll return |
|
230 | + * all cpt model names for cpts registered in EE. |
|
231 | + * @return array Empty array if no matching model names for the given slug |
|
232 | + * or an array of model names indexed by post type slug. |
|
233 | + */ |
|
234 | + public function getCustomPostTypeModelNames($post_type_slug = '') |
|
235 | + { |
|
236 | + $cpts = $this->getDefinitions(); |
|
237 | + // first if slug passed in... |
|
238 | + if (! empty($post_type_slug)) { |
|
239 | + // check that slug and cpt match |
|
240 | + if (! isset($cpts[ $post_type_slug ])) { |
|
241 | + return []; |
|
242 | + } |
|
243 | + if (empty($cpts[ $post_type_slug ]['class_name']) |
|
244 | + && empty($cpts[ $post_type_slug ]['model_name']) |
|
245 | + ) { |
|
246 | + return []; |
|
247 | + } |
|
248 | + // k let's get the model name for this cpt. |
|
249 | + return $this->getCustomPostTypeModelName($post_type_slug, $cpts[ $post_type_slug ]); |
|
250 | + } |
|
251 | + // if we made it here then we're returning an array of cpt model names indexed by post_type_slug. |
|
252 | + $cpt_models = []; |
|
253 | + foreach ($cpts as $slug => $args) { |
|
254 | + $model = $this->getCustomPostTypeModelName($post_type_slug, $cpts[ $post_type_slug ]); |
|
255 | + if (! empty($model)) { |
|
256 | + $cpt_models[ $slug ] = $model; |
|
257 | + } |
|
258 | + } |
|
259 | + return $cpt_models; |
|
260 | + } |
|
261 | 261 | |
262 | 262 | |
263 | - /** |
|
264 | - * @param $post_type_slug |
|
265 | - * @param array $cpt |
|
266 | - * @return array |
|
267 | - */ |
|
268 | - private function getCustomPostTypeModelName($post_type_slug, array $cpt) |
|
269 | - { |
|
270 | - if (! empty($cpt['model_name'])) { |
|
271 | - return [$post_type_slug => $cpt['model_name']]; |
|
272 | - } |
|
273 | - if (! empty($cpt['class_name'])) { |
|
274 | - return [ |
|
275 | - $post_type_slug => $this->deriveCptModelNameFromClassName($cpt['class_name']), |
|
276 | - ]; |
|
277 | - } |
|
278 | - return []; |
|
279 | - } |
|
263 | + /** |
|
264 | + * @param $post_type_slug |
|
265 | + * @param array $cpt |
|
266 | + * @return array |
|
267 | + */ |
|
268 | + private function getCustomPostTypeModelName($post_type_slug, array $cpt) |
|
269 | + { |
|
270 | + if (! empty($cpt['model_name'])) { |
|
271 | + return [$post_type_slug => $cpt['model_name']]; |
|
272 | + } |
|
273 | + if (! empty($cpt['class_name'])) { |
|
274 | + return [ |
|
275 | + $post_type_slug => $this->deriveCptModelNameFromClassName($cpt['class_name']), |
|
276 | + ]; |
|
277 | + } |
|
278 | + return []; |
|
279 | + } |
|
280 | 280 | |
281 | 281 | |
282 | - /** |
|
283 | - * @param string $class_name |
|
284 | - * @return string |
|
285 | - */ |
|
286 | - private function deriveCptModelNameFromClassName($class_name) |
|
287 | - { |
|
288 | - return str_replace('EE', 'EEM', $class_name); |
|
289 | - } |
|
282 | + /** |
|
283 | + * @param string $class_name |
|
284 | + * @return string |
|
285 | + */ |
|
286 | + private function deriveCptModelNameFromClassName($class_name) |
|
287 | + { |
|
288 | + return str_replace('EE', 'EEM', $class_name); |
|
289 | + } |
|
290 | 290 | |
291 | 291 | |
292 | - /** |
|
293 | - * This instantiates cpt models related to the cpts registered via EE. |
|
294 | - * |
|
295 | - * @param string $post_type_slug If valid slug is provided, then will instantiate the model only for |
|
296 | - * the cpt matching the given slug. Otherwise all cpt models will be |
|
297 | - * instantiated (if possible). |
|
298 | - * @return EEM_CPT_Base[] successful instantiation will return an array of successfully instantiated |
|
299 | - * EEM models indexed by post slug. |
|
300 | - * @since 4.6.16.rc.000 |
|
301 | - */ |
|
302 | - public function getCustomPostTypeModels($post_type_slug = '') |
|
303 | - { |
|
304 | - $cpt_model_names = $this->getCustomPostTypeModelNames($post_type_slug); |
|
305 | - $instantiated = []; |
|
306 | - foreach ($cpt_model_names as $slug => $model_name) { |
|
307 | - $model = $this->loader->getShared($model_name); |
|
308 | - if ($model instanceof EEM_CPT_Base) { |
|
309 | - $instantiated[ $slug ] = $model; |
|
310 | - } |
|
311 | - } |
|
312 | - return $instantiated; |
|
313 | - } |
|
292 | + /** |
|
293 | + * This instantiates cpt models related to the cpts registered via EE. |
|
294 | + * |
|
295 | + * @param string $post_type_slug If valid slug is provided, then will instantiate the model only for |
|
296 | + * the cpt matching the given slug. Otherwise all cpt models will be |
|
297 | + * instantiated (if possible). |
|
298 | + * @return EEM_CPT_Base[] successful instantiation will return an array of successfully instantiated |
|
299 | + * EEM models indexed by post slug. |
|
300 | + * @since 4.6.16.rc.000 |
|
301 | + */ |
|
302 | + public function getCustomPostTypeModels($post_type_slug = '') |
|
303 | + { |
|
304 | + $cpt_model_names = $this->getCustomPostTypeModelNames($post_type_slug); |
|
305 | + $instantiated = []; |
|
306 | + foreach ($cpt_model_names as $slug => $model_name) { |
|
307 | + $model = $this->loader->getShared($model_name); |
|
308 | + if ($model instanceof EEM_CPT_Base) { |
|
309 | + $instantiated[ $slug ] = $model; |
|
310 | + } |
|
311 | + } |
|
312 | + return $instantiated; |
|
313 | + } |
|
314 | 314 | } |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | 'public' => true, |
74 | 74 | 'show_in_nav_menus' => true, |
75 | 75 | 'show_in_graphql' => true, |
76 | - 'graphql_single_name' => $this->namespace . 'Event', |
|
77 | - 'graphql_plural_name' => $this->namespace . 'Events', |
|
76 | + 'graphql_single_name' => $this->namespace.'Event', |
|
77 | + 'graphql_plural_name' => $this->namespace.'Events', |
|
78 | 78 | 'capability_type' => 'event', |
79 | 79 | 'capabilities' => [ |
80 | 80 | 'edit_post' => 'ee_edit_event', |
@@ -110,8 +110,8 @@ discard block |
||
110 | 110 | 'public' => true, |
111 | 111 | 'show_in_nav_menus' => false, // by default this doesn't show for decaf, |
112 | 112 | 'show_in_graphql' => true, |
113 | - 'graphql_single_name' => $this->namespace . 'Venue', |
|
114 | - 'graphql_plural_name' => $this->namespace . 'Venues', |
|
113 | + 'graphql_single_name' => $this->namespace.'Venue', |
|
114 | + 'graphql_plural_name' => $this->namespace.'Venues', |
|
115 | 115 | 'capability_type' => 'venue', |
116 | 116 | 'capabilities' => [ |
117 | 117 | 'edit_post' => 'ee_edit_venue', |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $private_CPTs = []; |
215 | 215 | foreach ($this->getDefinitions() as $CPT => $details) { |
216 | 216 | if (empty($details['args']['public'])) { |
217 | - $private_CPTs[ $CPT ] = $details; |
|
217 | + $private_CPTs[$CPT] = $details; |
|
218 | 218 | } |
219 | 219 | } |
220 | 220 | return $private_CPTs; |
@@ -235,25 +235,25 @@ discard block |
||
235 | 235 | { |
236 | 236 | $cpts = $this->getDefinitions(); |
237 | 237 | // first if slug passed in... |
238 | - if (! empty($post_type_slug)) { |
|
238 | + if ( ! empty($post_type_slug)) { |
|
239 | 239 | // check that slug and cpt match |
240 | - if (! isset($cpts[ $post_type_slug ])) { |
|
240 | + if ( ! isset($cpts[$post_type_slug])) { |
|
241 | 241 | return []; |
242 | 242 | } |
243 | - if (empty($cpts[ $post_type_slug ]['class_name']) |
|
244 | - && empty($cpts[ $post_type_slug ]['model_name']) |
|
243 | + if (empty($cpts[$post_type_slug]['class_name']) |
|
244 | + && empty($cpts[$post_type_slug]['model_name']) |
|
245 | 245 | ) { |
246 | 246 | return []; |
247 | 247 | } |
248 | 248 | // k let's get the model name for this cpt. |
249 | - return $this->getCustomPostTypeModelName($post_type_slug, $cpts[ $post_type_slug ]); |
|
249 | + return $this->getCustomPostTypeModelName($post_type_slug, $cpts[$post_type_slug]); |
|
250 | 250 | } |
251 | 251 | // if we made it here then we're returning an array of cpt model names indexed by post_type_slug. |
252 | 252 | $cpt_models = []; |
253 | 253 | foreach ($cpts as $slug => $args) { |
254 | - $model = $this->getCustomPostTypeModelName($post_type_slug, $cpts[ $post_type_slug ]); |
|
255 | - if (! empty($model)) { |
|
256 | - $cpt_models[ $slug ] = $model; |
|
254 | + $model = $this->getCustomPostTypeModelName($post_type_slug, $cpts[$post_type_slug]); |
|
255 | + if ( ! empty($model)) { |
|
256 | + $cpt_models[$slug] = $model; |
|
257 | 257 | } |
258 | 258 | } |
259 | 259 | return $cpt_models; |
@@ -267,10 +267,10 @@ discard block |
||
267 | 267 | */ |
268 | 268 | private function getCustomPostTypeModelName($post_type_slug, array $cpt) |
269 | 269 | { |
270 | - if (! empty($cpt['model_name'])) { |
|
270 | + if ( ! empty($cpt['model_name'])) { |
|
271 | 271 | return [$post_type_slug => $cpt['model_name']]; |
272 | 272 | } |
273 | - if (! empty($cpt['class_name'])) { |
|
273 | + if ( ! empty($cpt['class_name'])) { |
|
274 | 274 | return [ |
275 | 275 | $post_type_slug => $this->deriveCptModelNameFromClassName($cpt['class_name']), |
276 | 276 | ]; |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | foreach ($cpt_model_names as $slug => $model_name) { |
307 | 307 | $model = $this->loader->getShared($model_name); |
308 | 308 | if ($model instanceof EEM_CPT_Base) { |
309 | - $instantiated[ $slug ] = $model; |
|
309 | + $instantiated[$slug] = $model; |
|
310 | 310 | } |
311 | 311 | } |
312 | 312 | return $instantiated; |
@@ -13,93 +13,93 @@ |
||
13 | 13 | abstract class EnumBase implements EnumInterface |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * @var string $namespace The graphql namespace/prefix. |
|
18 | - */ |
|
19 | - protected $namespace = 'Espresso'; |
|
20 | - |
|
21 | - /** |
|
22 | - * @var string $name |
|
23 | - */ |
|
24 | - protected $name = ''; |
|
25 | - |
|
26 | - /** |
|
27 | - * @var string $description |
|
28 | - */ |
|
29 | - protected $description = ''; |
|
30 | - |
|
31 | - /** |
|
32 | - * @var array $values |
|
33 | - */ |
|
34 | - protected $values = []; |
|
35 | - |
|
36 | - /** |
|
37 | - * EnumBase constructor. |
|
38 | - */ |
|
39 | - public function __construct() |
|
40 | - { |
|
41 | - $this->setValues($this->getValues()); |
|
42 | - } |
|
43 | - |
|
44 | - |
|
45 | - /** |
|
46 | - * @return array |
|
47 | - * @since $VID:$ |
|
48 | - */ |
|
49 | - abstract protected function getValues(); |
|
50 | - |
|
51 | - |
|
52 | - /** |
|
53 | - * @return string |
|
54 | - */ |
|
55 | - public function name() |
|
56 | - { |
|
57 | - return $this->name; |
|
58 | - } |
|
59 | - |
|
60 | - |
|
61 | - /** |
|
62 | - * @param string $name |
|
63 | - */ |
|
64 | - protected function setName($name) |
|
65 | - { |
|
66 | - $this->name = $name; |
|
67 | - } |
|
68 | - |
|
69 | - |
|
70 | - /** |
|
71 | - * @return string |
|
72 | - */ |
|
73 | - public function description() |
|
74 | - { |
|
75 | - return $this->description; |
|
76 | - } |
|
77 | - |
|
78 | - |
|
79 | - /** |
|
80 | - * @param string $description |
|
81 | - */ |
|
82 | - protected function setDescription($description) |
|
83 | - { |
|
84 | - $this->description = $description; |
|
85 | - } |
|
86 | - |
|
87 | - |
|
88 | - /** |
|
89 | - * @return array |
|
90 | - * @since $VID:$ |
|
91 | - */ |
|
92 | - public function values() |
|
93 | - { |
|
94 | - return (array) $this->values; |
|
95 | - } |
|
96 | - |
|
97 | - |
|
98 | - /** |
|
99 | - * @param array $values |
|
100 | - */ |
|
101 | - protected function setValues(array $values) |
|
102 | - { |
|
103 | - $this->values = $values; |
|
104 | - } |
|
16 | + /** |
|
17 | + * @var string $namespace The graphql namespace/prefix. |
|
18 | + */ |
|
19 | + protected $namespace = 'Espresso'; |
|
20 | + |
|
21 | + /** |
|
22 | + * @var string $name |
|
23 | + */ |
|
24 | + protected $name = ''; |
|
25 | + |
|
26 | + /** |
|
27 | + * @var string $description |
|
28 | + */ |
|
29 | + protected $description = ''; |
|
30 | + |
|
31 | + /** |
|
32 | + * @var array $values |
|
33 | + */ |
|
34 | + protected $values = []; |
|
35 | + |
|
36 | + /** |
|
37 | + * EnumBase constructor. |
|
38 | + */ |
|
39 | + public function __construct() |
|
40 | + { |
|
41 | + $this->setValues($this->getValues()); |
|
42 | + } |
|
43 | + |
|
44 | + |
|
45 | + /** |
|
46 | + * @return array |
|
47 | + * @since $VID:$ |
|
48 | + */ |
|
49 | + abstract protected function getValues(); |
|
50 | + |
|
51 | + |
|
52 | + /** |
|
53 | + * @return string |
|
54 | + */ |
|
55 | + public function name() |
|
56 | + { |
|
57 | + return $this->name; |
|
58 | + } |
|
59 | + |
|
60 | + |
|
61 | + /** |
|
62 | + * @param string $name |
|
63 | + */ |
|
64 | + protected function setName($name) |
|
65 | + { |
|
66 | + $this->name = $name; |
|
67 | + } |
|
68 | + |
|
69 | + |
|
70 | + /** |
|
71 | + * @return string |
|
72 | + */ |
|
73 | + public function description() |
|
74 | + { |
|
75 | + return $this->description; |
|
76 | + } |
|
77 | + |
|
78 | + |
|
79 | + /** |
|
80 | + * @param string $description |
|
81 | + */ |
|
82 | + protected function setDescription($description) |
|
83 | + { |
|
84 | + $this->description = $description; |
|
85 | + } |
|
86 | + |
|
87 | + |
|
88 | + /** |
|
89 | + * @return array |
|
90 | + * @since $VID:$ |
|
91 | + */ |
|
92 | + public function values() |
|
93 | + { |
|
94 | + return (array) $this->values; |
|
95 | + } |
|
96 | + |
|
97 | + |
|
98 | + /** |
|
99 | + * @param array $values |
|
100 | + */ |
|
101 | + protected function setValues(array $values) |
|
102 | + { |
|
103 | + $this->values = $values; |
|
104 | + } |
|
105 | 105 | } |
@@ -16,97 +16,97 @@ |
||
16 | 16 | abstract class InputBase implements InputInterface |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * @var string $namespace The graphql namespace/prefix. |
|
21 | - */ |
|
22 | - protected $namespace = 'Espresso'; |
|
23 | - |
|
24 | - /** |
|
25 | - * @var string $name |
|
26 | - */ |
|
27 | - protected $name = ''; |
|
28 | - |
|
29 | - /** |
|
30 | - * @var string $description |
|
31 | - */ |
|
32 | - protected $description = ''; |
|
33 | - |
|
34 | - /** |
|
35 | - * @var GraphQLFieldInterface[] $fields |
|
36 | - */ |
|
37 | - protected $fields = []; |
|
38 | - |
|
39 | - /** |
|
40 | - * InputBase constructor. |
|
41 | - */ |
|
42 | - public function __construct() |
|
43 | - { |
|
44 | - $this->setFields($this->getFields()); |
|
45 | - } |
|
46 | - |
|
47 | - |
|
48 | - /** |
|
49 | - * @return GraphQLFieldInterface[] |
|
50 | - * @since $VID:$ |
|
51 | - */ |
|
52 | - abstract protected function getFields(); |
|
53 | - |
|
54 | - |
|
55 | - /** |
|
56 | - * @return string |
|
57 | - */ |
|
58 | - public function name() |
|
59 | - { |
|
60 | - return $this->name; |
|
61 | - } |
|
62 | - |
|
63 | - |
|
64 | - /** |
|
65 | - * @param string $name |
|
66 | - */ |
|
67 | - protected function setName($name) |
|
68 | - { |
|
69 | - $this->name = $name; |
|
70 | - } |
|
71 | - |
|
72 | - |
|
73 | - /** |
|
74 | - * @return string |
|
75 | - */ |
|
76 | - public function description() |
|
77 | - { |
|
78 | - return $this->description; |
|
79 | - } |
|
80 | - |
|
81 | - |
|
82 | - /** |
|
83 | - * @param string $description |
|
84 | - */ |
|
85 | - protected function setDescription($description) |
|
86 | - { |
|
87 | - $this->description = $description; |
|
88 | - } |
|
89 | - |
|
90 | - |
|
91 | - /** |
|
92 | - * @return GraphQLFieldInterface[] |
|
93 | - * @since $VID:$ |
|
94 | - */ |
|
95 | - public function fields() |
|
96 | - { |
|
97 | - return (array) $this->fields; |
|
98 | - } |
|
99 | - |
|
100 | - |
|
101 | - /** |
|
102 | - * @param GraphQLFieldInterface[] $fields |
|
103 | - */ |
|
104 | - protected function setFields(array $fields) |
|
105 | - { |
|
106 | - foreach ($fields as $field) { |
|
107 | - if ($field instanceof GraphQLField) { |
|
108 | - $this->fields[] = $field; |
|
109 | - } |
|
110 | - } |
|
111 | - } |
|
19 | + /** |
|
20 | + * @var string $namespace The graphql namespace/prefix. |
|
21 | + */ |
|
22 | + protected $namespace = 'Espresso'; |
|
23 | + |
|
24 | + /** |
|
25 | + * @var string $name |
|
26 | + */ |
|
27 | + protected $name = ''; |
|
28 | + |
|
29 | + /** |
|
30 | + * @var string $description |
|
31 | + */ |
|
32 | + protected $description = ''; |
|
33 | + |
|
34 | + /** |
|
35 | + * @var GraphQLFieldInterface[] $fields |
|
36 | + */ |
|
37 | + protected $fields = []; |
|
38 | + |
|
39 | + /** |
|
40 | + * InputBase constructor. |
|
41 | + */ |
|
42 | + public function __construct() |
|
43 | + { |
|
44 | + $this->setFields($this->getFields()); |
|
45 | + } |
|
46 | + |
|
47 | + |
|
48 | + /** |
|
49 | + * @return GraphQLFieldInterface[] |
|
50 | + * @since $VID:$ |
|
51 | + */ |
|
52 | + abstract protected function getFields(); |
|
53 | + |
|
54 | + |
|
55 | + /** |
|
56 | + * @return string |
|
57 | + */ |
|
58 | + public function name() |
|
59 | + { |
|
60 | + return $this->name; |
|
61 | + } |
|
62 | + |
|
63 | + |
|
64 | + /** |
|
65 | + * @param string $name |
|
66 | + */ |
|
67 | + protected function setName($name) |
|
68 | + { |
|
69 | + $this->name = $name; |
|
70 | + } |
|
71 | + |
|
72 | + |
|
73 | + /** |
|
74 | + * @return string |
|
75 | + */ |
|
76 | + public function description() |
|
77 | + { |
|
78 | + return $this->description; |
|
79 | + } |
|
80 | + |
|
81 | + |
|
82 | + /** |
|
83 | + * @param string $description |
|
84 | + */ |
|
85 | + protected function setDescription($description) |
|
86 | + { |
|
87 | + $this->description = $description; |
|
88 | + } |
|
89 | + |
|
90 | + |
|
91 | + /** |
|
92 | + * @return GraphQLFieldInterface[] |
|
93 | + * @since $VID:$ |
|
94 | + */ |
|
95 | + public function fields() |
|
96 | + { |
|
97 | + return (array) $this->fields; |
|
98 | + } |
|
99 | + |
|
100 | + |
|
101 | + /** |
|
102 | + * @param GraphQLFieldInterface[] $fields |
|
103 | + */ |
|
104 | + protected function setFields(array $fields) |
|
105 | + { |
|
106 | + foreach ($fields as $field) { |
|
107 | + if ($field instanceof GraphQLField) { |
|
108 | + $this->fields[] = $field; |
|
109 | + } |
|
110 | + } |
|
111 | + } |
|
112 | 112 | } |
@@ -13,13 +13,13 @@ |
||
13 | 13 | abstract class ConnectionBase implements ConnectionInterface |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * @var EEM_Base $model |
|
18 | - */ |
|
19 | - protected $model; |
|
16 | + /** |
|
17 | + * @var EEM_Base $model |
|
18 | + */ |
|
19 | + protected $model; |
|
20 | 20 | |
21 | - /** |
|
22 | - * @var string $namespace The graphql namespace/prefix. |
|
23 | - */ |
|
24 | - protected $namespace = 'Espresso'; |
|
21 | + /** |
|
22 | + * @var string $namespace The graphql namespace/prefix. |
|
23 | + */ |
|
24 | + protected $namespace = 'Espresso'; |
|
25 | 25 | } |