Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions includes/abilities/class-scf-abilities-integration.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public function init() {
acf_include( 'includes/abilities/class-scf-internal-post-type-abilities.php' );
acf_include( 'includes/abilities/class-scf-post-type-abilities.php' );
acf_include( 'includes/abilities/class-scf-taxonomy-abilities.php' );
acf_include( 'includes/abilities/class-scf-ui-options-page-abilities.php' );
}

/**
Expand Down
41 changes: 41 additions & 0 deletions includes/abilities/class-scf-ui-options-page-abilities.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php
/**
* SCF UI Options Page Abilities
*
* Handles WordPress Abilities API registration for SCF UI options page management.
*
* @package wordpress/secure-custom-fields
* @since 6.8.0
* @codeCoverageIgnore Base class is tested.
*/

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}

if ( ! class_exists( 'SCF_UI_Options_Page_Abilities' ) ) :

/**
* SCF UI Options Page Abilities class.
*
* Registers and handles all UI options page management abilities for the
* WordPress Abilities API integration. Provides programmatic access
* to SCF UI options page operations.
*
* @since 6.8.0
*/
class SCF_UI_Options_Page_Abilities extends SCF_Internal_Post_Type_Abilities {

/**
* The internal post type identifier.
*
* @var string
*/
protected $internal_post_type = 'acf-ui-options-page';
}

// Initialize abilities instance.
acf_new_instance( 'SCF_UI_Options_Page_Abilities' );

endif; // class_exists check.
2 changes: 1 addition & 1 deletion includes/class-scf-json-schema-validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class SCF_JSON_Schema_Validator {
*
* @var array
*/
public const REQUIRED_SCHEMAS = array( 'post-type', 'taxonomy', 'internal-fields', 'scf-identifier' );
public const REQUIRED_SCHEMAS = array( 'post-type', 'taxonomy', 'ui-options-page', 'internal-fields', 'scf-identifier' );

/**
* The last validation errors.
Expand Down
17 changes: 14 additions & 3 deletions tests/e2e/abilities-internal-post-types.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* E2E tests for SCF Internal Post Type Abilities (Post Types and Taxonomies)
* E2E tests for SCF Internal Post Type Abilities (Post Types, Taxonomies, and UI Options Pages)
*
* Tests the WordPress Abilities API endpoints for SCF post type and taxonomy management.
* Both entity types share the same base class, so tests are parameterized.
* Tests the WordPress Abilities API endpoints for SCF internal post type management.
* All entity types share the same base class, so tests are parameterized.
*
* HTTP Method Reference:
* - Read-only abilities (readonly: true) → GET with bracket notation: { 'input[key]': value }
Expand Down Expand Up @@ -43,6 +43,17 @@
taxonomy: 'e2e_test_tax',
},
},
{
name: 'UI Options Page',
slug: 'ui-options-page',
slugPlural: 'ui-options-pages',
identifierKey: 'menu_slug',
testEntity: {
key: 'ui_options_page_e2e_test',
title: 'E2E Test Options Page',
menu_slug: 'e2e-test-options',
},
},
];

// Shared helper functions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
// Load mock Abilities API functions before loading the class.
require_once __DIR__ . '/abilities-api-mocks.php';

// Load ACF internal post type class to register the taxonomy instance.
// Load ACF_Taxonomy class required by SCF_Taxonomy_Abilities.
require_once dirname( __DIR__, 4 ) . '/includes/post-types/class-acf-taxonomy.php';

// Load the abilities classes after ACF classes are loaded.
// Load abilities classes for testing.
require_once dirname( __DIR__, 4 ) . '/includes/abilities/class-scf-internal-post-type-abilities.php';
require_once dirname( __DIR__, 4 ) . '/includes/abilities/class-scf-taxonomy-abilities.php';

Expand Down
Loading