| 1 |
<?php |
| 2 |
/** |
| 3 |
* Merchant Module Abilities Interface. |
| 4 |
* |
| 5 |
* Defines the contract for module-specific campaign handling |
| 6 |
* and operation discovery in the WP Abilities API layer. |
| 7 |
* |
| 8 |
* @package Merchant |
| 9 |
* @since 2.3.0 |
| 10 |
*/ |
| 11 |
|
| 12 |
if ( ! defined( 'ABSPATH' ) ) { |
| 13 |
exit; |
| 14 |
} |
| 15 |
|
| 16 |
/** |
| 17 |
* Merchant_Module_Abilities_Interface |
| 18 |
* |
| 19 |
* Modules can implement this interface to provide richer |
| 20 |
* campaign summaries, custom field transformations, and |
| 21 |
* fine-grained operation discovery for the WP Abilities API. |
| 22 |
* |
| 23 |
* @since 2.3.0 |
| 24 |
*/ |
| 25 |
interface Merchant_Module_Abilities_Interface { |
| 26 |
|
| 27 |
/** |
| 28 |
* Get the flexible_content field ID used for campaigns. |
| 29 |
* |
| 30 |
* Return null for settings-only modules. |
| 31 |
* |
| 32 |
* @return string|null Campaign field ID, or null if not campaign-based. |
| 33 |
*/ |
| 34 |
public function get_campaign_field_id(); |
| 35 |
|
| 36 |
/** |
| 37 |
* Get the field used as the campaign title/name. |
| 38 |
* |
| 39 |
* @return string The campaign title field key. |
| 40 |
*/ |
| 41 |
public function get_campaign_title_field(); |
| 42 |
|
| 43 |
/** |
| 44 |
* Get a human-readable summary of a campaign's configuration. |
| 45 |
* |
| 46 |
* @param array<string, mixed> $campaign_data Raw campaign field values. |
| 47 |
* |
| 48 |
* @return array<string, mixed> Key highlights of this campaign. |
| 49 |
*/ |
| 50 |
public function summarize_campaign( $campaign_data ); |
| 51 |
|
| 52 |
/** |
| 53 |
* Return schema overrides, or null to use fully auto-generated schema. |
| 54 |
* |
| 55 |
* @return array<string, mixed>|null Schema overrides. |
| 56 |
*/ |
| 57 |
public function get_schema_overrides(); |
| 58 |
|
| 59 |
/** |
| 60 |
* Get the list of available operations for this module. |
| 61 |
* |
| 62 |
* @return array<int, string> e.g., ['get-settings', 'update-settings', 'list-campaigns', ...] |
| 63 |
*/ |
| 64 |
public function get_available_operations(); |
| 65 |
} |
| 66 |
|