refactor: Divi catalog adapter with manifest
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -60,7 +60,7 @@ final class DiviCompatibility
|
||||
static fn (): bool => method_exists(DiviLibraryStore::GLOBAL_LAYOUT, 'is_global_layout_template'),
|
||||
'ET_Core_PageResource (CSS-Cache)' => static fn (): bool => class_exists('ET_Core_PageResource'),
|
||||
'Block-Typ divi/global-layout (Instanzen globaler Module)' =>
|
||||
static fn (): bool => self::knowsGlobalLayout(),
|
||||
static fn (): bool => DiviModules::knowsBlock(GlobalInstance::BLOCK),
|
||||
'Taxonomien layout_category, layout_tag (Bibliothek)' =>
|
||||
static fn (): bool => taxonomy_exists('layout_category') && taxonomy_exists('layout_tag'),
|
||||
// Includes et_theme_builder_clear_wp_cache (Theme Builder cache of every site-wide clear, review M-2).
|
||||
@@ -72,32 +72,4 @@ final class DiviCompatibility
|
||||
) === [],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether Divi still has the block type of global instances (GlobalInstance::BLOCK): registered
|
||||
* with WordPress, or in Divi's core module metadata (Divi renders instances itself, BlockParser,
|
||||
* and does not always register the type with WordPress).
|
||||
*/
|
||||
private static function knowsGlobalLayout(): bool
|
||||
{
|
||||
if (
|
||||
class_exists('WP_Block_Type_Registry')
|
||||
&& \WP_Block_Type_Registry::get_instance()->is_registered(GlobalInstance::BLOCK)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$registration = 'ET\Builder\Packages\ModuleLibrary\ModuleRegistration';
|
||||
if (! method_exists($registration, 'get_all_core_modules_metadata')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ((array) $registration::get_all_core_modules_metadata() as $module) {
|
||||
if (is_array($module) && ($module['name'] ?? null) === GlobalInstance::BLOCK) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user