| 1 |
<?php |
| 2 |
|
| 3 |
namespace Elementor\Modules\Mcp\Abilities; |
| 4 |
|
| 5 |
use Elementor\Modules\Interactions\Props\Interaction_Item_Prop_Type; |
| 6 |
use Elementor\Modules\Mcp\Abilities\Utils\Widget_Context_Helper; |
| 7 |
|
| 8 |
if ( ! defined( 'ABSPATH' ) ) { |
| 9 |
exit; |
| 10 |
} |
| 11 |
|
| 12 |
class Interactions_Schema_Resource_Ability extends Abstract_Ability { |
| 13 |
const URI = 'elementor://interactions/schema'; |
| 14 |
|
| 15 |
protected function get_ability_id(): string { |
| 16 |
return 'elementor/interactions-schema-resource'; |
| 17 |
} |
| 18 |
|
| 19 |
protected function get_definition(): Ability_Definition { |
| 20 |
return new Ability_Definition( |
| 21 |
__( 'Interactions Schema', 'elementor' ), |
| 22 |
__( 'Native interaction item schema: shape, allowed enums, and defaults for build-composition.', 'elementor' ), |
| 23 |
'elementor', |
| 24 |
[ 'type' => 'string' ], |
| 25 |
[ |
| 26 |
'mcp' => [ |
| 27 |
'type' => 'resource', |
| 28 |
'uri' => self::URI, |
| 29 |
'public' => true, |
| 30 |
'mimeType' => 'application/json', |
| 31 |
'description' => __( 'Interaction item shape, enums, and defaults for build-composition.', 'elementor' ), |
| 32 |
], |
| 33 |
], |
| 34 |
fn() => current_user_can( 'edit_posts' ) |
| 35 |
); |
| 36 |
} |
| 37 |
|
| 38 |
public function execute( $input = [] ) { |
| 39 |
return wp_json_encode( Widget_Context_Helper::to_plain_llm_schema( Interaction_Item_Prop_Type::make() ) ); |
| 40 |
} |
| 41 |
} |
| 42 |
|