PluginProbe ʕ •ᴥ•ʔ
Secure Custom Fields / trunk
Secure Custom Fields vtrunk
6.9.1 6.9.0 6.8.9 6.8.7 6.8.8 6.8.6 6.8.4 6.8.5 trunk 6.4.0-beta1 6.4.0-beta2 6.4.1 6.4.1-beta3 6.4.1-beta4 6.4.1-beta5 6.4.1-beta6 6.4.1-beta7 6.4.2 6.5.0 6.5.1 6.5.2 6.5.3 6.5.4 6.5.5 6.5.6 6.5.7 6.6.0 6.7.0 6.7.1 6.8.0 6.8.1 6.8.2 6.8.3
secure-custom-fields / includes / abilities / class-scf-field-group-abilities.php
secure-custom-fields / includes / abilities Last commit date
class-scf-abilities-integration.php 6 months ago class-scf-field-abilities.php 3 weeks ago class-scf-field-group-abilities.php 6 months ago class-scf-internal-post-type-abilities.php 3 weeks ago class-scf-post-type-abilities.php 7 months ago class-scf-taxonomy-abilities.php 7 months ago class-scf-ui-options-page-abilities.php 6 months ago
class-scf-field-group-abilities.php
68 lines
1 <?php
2 /**
3 * SCF Field Group Abilities
4 *
5 * Handles WordPress Abilities API registration for SCF field group management.
6 *
7 * @package wordpress/secure-custom-fields
8 * @since 6.8.0
9 */
10
11 // Exit if accessed directly.
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit;
14 }
15
16 if ( ! class_exists( 'SCF_Field_Group_Abilities' ) ) :
17
18 /**
19 * SCF Field Group Abilities class.
20 *
21 * Registers and handles all field group management abilities for the
22 * WordPress Abilities API integration. Provides programmatic access
23 * to SCF field group operations.
24 *
25 * @since 6.8.0
26 */
27 class SCF_Field_Group_Abilities extends SCF_Internal_Post_Type_Abilities {
28
29 /**
30 * The internal post type identifier.
31 *
32 * @var string
33 */
34 protected $internal_post_type = 'acf-field-group';
35
36 /**
37 * Handles the list ability callback.
38 *
39 * Overrides parent to ignore location rules. Field groups use location rules
40 * to determine which edit screens they appear on - this is a UX feature for
41 * showing contextually relevant field groups, not access control.
42 *
43 * The abilities API should return all field groups regardless of location
44 * rules, so we bypass that filtering while preserving other filters like
45 * active status.
46 *
47 * @since 6.8.0
48 *
49 * @param array $input The input parameters.
50 * @return array List of field groups.
51 */
52 public function list_callback( $input ) {
53 // Ensure filter is an array (REST API may pass empty string for empty filter).
54 $filter = isset( $input['filter'] ) && is_array( $input['filter'] ) ? $input['filter'] : array();
55
56 // Location rules are a UX feature for edit screens, not access control.
57 $filter['ignore_location_rules'] = true;
58
59 $instance = acf_get_internal_post_type_instance( $this->internal_post_type );
60 return $instance->filter_posts( $instance->get_posts(), $filter );
61 }
62 }
63
64 // Initialize abilities instance.
65 acf_new_instance( 'SCF_Field_Group_Abilities' );
66
67 endif; // class_exists check.
68