Code Duplication    Length = 20-21 lines in 3 locations

includes/class-wp-fields-api-control.php 1 location

@@ 265-284 (lines=20) @@
262
	 *
263
	 * @return bool Whether the control is active to the current preview.
264
	 */
265
	final public function active() {
266
267
		$control = $this;
268
		$active = true;
269
270
		if ( is_callable( $this->active_callback ) ) {
271
			$active = call_user_func( $this->active_callback, $this );
272
		}
273
274
		/**
275
		 * Filter response of WP_Fields_API_Control::active().
276
		 *
277
		 * @param bool                  $active  Whether the Field control is active.
278
		 * @param WP_Fields_API_Control $control WP_Fields_API_Control instance.
279
		 */
280
		$active = apply_filters( 'fields_control_active_' . $this->object_type, $active, $control );
281
282
		return $active;
283
284
	}
285
286
	/**
287
	 * Default callback used when invoking WP_Fields_API_Control::active().

includes/class-wp-fields-api-screen.php 1 location

@@ 201-221 (lines=21) @@
198
	 *
199
	 * @return bool Whether the screen is active to the current preview.
200
	 */
201
	final public function active() {
202
203
		$screen = $this;
204
		$active = true;
205
206
		if ( is_callable( $this->active_callback ) ) {
207
			$active = call_user_func( $this->active_callback, $this );
208
		}
209
210
		/**
211
		 * Filter response of WP_Fields_API_Screen::active().
212
		 *
213
		 *
214
		 * @param bool                $active  Whether the Fields API screen is active.
215
		 * @param WP_Fields_API_Screen $screen   {@see WP_Fields_API_Screen} instance.
216
		 */
217
		$active = apply_filters( 'fields_api_screen_active_' . $this->object_type, $active, $screen );
218
219
		return $active;
220
221
	}
222
223
	/**
224
	 * Default callback used when invoking {@see WP_Fields_API_Screen::active()}.

includes/class-wp-fields-api-section.php 1 location

@@ 222-241 (lines=20) @@
219
	 *
220
	 * @return bool Whether the section is active to the current preview.
221
	 */
222
	final public function active() {
223
224
		$section = $this;
225
		$active = true;
226
227
		if ( is_callable( $this->active_callback ) ) {
228
			$active = call_user_func( $this->active_callback, $this );
229
		}
230
231
		/**
232
		 * Filter response of {@see WP_Fields_API_Section::active()}.
233
		 *
234
		 * @param bool                 $active  Whether the Fields API section is active.
235
		 * @param WP_Fields_API_Section $section {@see WP_Fields_API_Section} instance.
236
		 */
237
		$active = apply_filters( 'fields_api_section_active_' . $this->object_type, $active, $section );
238
239
		return $active;
240
241
	}
242
243
	/**
244
	 * Default callback used when invoking {@see WP_Fields_API_Section::active()}.