feat: jedes Divi-Tool und lit/content-create erklärt seine Divi-Fähigkeiten (RequiresDiviFeatures, DeclaresRequirements, FeatureSets); Tabelle Tool → Fähigkeiten als Test
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
e387d8d29e
commit
fdbda8012c
@@ -35,6 +35,15 @@ interface ContentComposer
|
||||
*/
|
||||
public function refusal(): ?WP_Error;
|
||||
|
||||
/**
|
||||
* IDs of the capabilities of the composing integration that composing a new entry needs (the Divi integration:
|
||||
* the DiviFeature values). lit/content-create hands them on as DeclaresRequirements; the core never interprets
|
||||
* them.
|
||||
*
|
||||
* @return list<string>
|
||||
*/
|
||||
public function requirements(): array;
|
||||
|
||||
/**
|
||||
* Validates the description for a new entry of $postType. Nothing is written.
|
||||
*
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace LIT\MCP\Integrations\WordPress\Content;
|
||||
|
||||
use LIT\MCP\Abilities\Ability;
|
||||
use LIT\MCP\Abilities\Annotations;
|
||||
use LIT\MCP\Abilities\DeclaresRequirements;
|
||||
use LIT\MCP\Abilities\Errors;
|
||||
use LIT\MCP\Abilities\Rev;
|
||||
use LIT\MCP\Abilities\ToolResult;
|
||||
@@ -32,7 +33,7 @@ defined('ABSPATH') || exit;
|
||||
* (title/excerpt keep kses), then the composer stores the layout (DiviSaver's kses window, spec
|
||||
* D7) – a refusal or failure there deletes the draft again.
|
||||
*/
|
||||
final class ContentCreateAbility implements Ability
|
||||
final class ContentCreateAbility implements Ability, DeclaresRequirements
|
||||
{
|
||||
/** The extras (written after the layout) re-saved the entry and changed the stored layout (review m-6). */
|
||||
public const LAYOUT_CHANGED = 'Der Divi-Inhalt wurde beim Speichern der Felder verändert (z. B. durch ein Plugin); '
|
||||
@@ -109,6 +110,15 @@ final class ContentCreateAbility implements Ability
|
||||
return $type instanceof WP_Error ? $type : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Without divi the call stays in WordPress and needs nothing; with divi it needs what the ContentComposer says it
|
||||
* needs (the Divi integration names its capabilities), so the guard refuses before a draft is inserted.
|
||||
*/
|
||||
public function requirements(array $input): array
|
||||
{
|
||||
return array_key_exists('divi', $input) && $this->divi !== null ? $this->divi->requirements() : [];
|
||||
}
|
||||
|
||||
public function execute(array $input): mixed
|
||||
{
|
||||
$type = PostGuard::postType($input['post_type'] ?? null, $this->schema, 'create_posts');
|
||||
|
||||
Reference in New Issue
Block a user