refactor: Divi catalog adapter with manifest

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-30 00:54:48 +02:00
co-authored by Claude Opus 5.5
parent 5e6d5ff3e1
commit fc7a84d239
8 changed files with 164 additions and 46 deletions
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace LIT\MCP\Integrations\WordPress\Schema;
use LIT\MCP\Integrations\Divi\Schema\DiviModules;
use LogicException;
defined('ABSPATH') || exit;
@@ -18,9 +19,8 @@ class ContentSchema
/** Post types handled elsewhere (media tools, Divi tools, WordPress internals). */
public const EXCLUDED = [
'attachment', 'nav_menu_item', 'revision', 'wp_block', 'wp_template', 'wp_template_part',
'wp_navigation', 'wp_global_styles', 'wp_font_family', 'wp_font_face', 'et_pb_layout',
'et_theme_builder', 'et_template', 'et_header_layout', 'et_body_layout', 'et_footer_layout',
'et_pb_canvas', '_et_pb_speculation',
'wp_navigation', 'wp_global_styles', 'wp_font_family', 'wp_font_face',
...DiviModules::INTERNAL_POST_TYPES,
];
private const COUNTED_STATUSES = ['publish', 'draft', 'pending', 'private', 'future'];
@@ -36,10 +36,7 @@ class ContentSchema
*/
public function __construct(private array $sources, ?callable $diviEnabled = null)
{
$this->diviEnabled = $diviEnabled ?? static function (string $postType): bool {
return function_exists('et_builder_enabled_for_post_type')
&& (bool) et_builder_enabled_for_post_type($postType);
};
$this->diviEnabled = $diviEnabled ?? DiviModules::builderEnabledFor(...);
}
/** @return list<string> */