refactor: Divi catalog adapter with manifest
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -7,13 +7,16 @@ namespace LIT\MCP\Integrations\Divi\Pages;
|
||||
use Closure;
|
||||
use LIT\MCP\Integrations\Divi\Compose\Placeholders;
|
||||
use LIT\MCP\Integrations\Divi\Compose\DynamicContentRules;
|
||||
use LIT\MCP\Integrations\Divi\Release\Call;
|
||||
use LIT\MCP\Integrations\Divi\Release\DiviAdapter;
|
||||
use LIT\MCP\Integrations\Divi\Release\Manifest;
|
||||
use LIT\MCP\Log;
|
||||
use Throwable;
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
/**
|
||||
* DynamicContentRules' dynamic content allow map (ruling S22) from Divi's live registry
|
||||
* Adapter "Katalog" (spec §3): DynamicContentRules' dynamic content allow map (ruling S22) from Divi's live registry
|
||||
* DynamicContentOptions::get_options($postId, 'edit') – the options the Visual Builder offers
|
||||
* for this entry (filter divi_module_dynamic_content_options; the list depends on the post:
|
||||
* post_categories/post_tags only for types with those taxonomies). Shape:
|
||||
@@ -29,9 +32,9 @@ defined('ABSPATH') || exit;
|
||||
*
|
||||
* Not final so abilities can be tested with a fake registry.
|
||||
*/
|
||||
class DynamicContentMap
|
||||
class DynamicContentMap implements DiviAdapter
|
||||
{
|
||||
/** Divi's dynamic-content registry class; also checked by DiviCompatibility. */
|
||||
/** Divi's dynamic-content registry class; listed in manifest(). */
|
||||
public const REGISTRY = 'ET\Builder\Packages\Module\Layout\Components\DynamicContent\DynamicContentOptions';
|
||||
|
||||
/**
|
||||
@@ -41,6 +44,11 @@ class DynamicContentMap
|
||||
{
|
||||
}
|
||||
|
||||
public static function manifest(): Manifest
|
||||
{
|
||||
return new Manifest(Manifest::CATALOG, calls: [new Call(self::REGISTRY . '::get_options', 2)]);
|
||||
}
|
||||
|
||||
/** @return array<string, array<string, string>>|null Null = use DynamicContentRules' default map. */
|
||||
public function forPost(int $postId): ?array
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user