refactor: Divi library adapters with manifest and submit-layout mirror
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6,18 +6,21 @@ namespace LIT\MCP\Integrations\Divi\Library;
|
||||
|
||||
use Closure;
|
||||
use LIT\MCP\Abilities\Errors;
|
||||
use LIT\MCP\Integrations\Divi\Release\Call;
|
||||
use LIT\MCP\Integrations\Divi\Release\DiviAdapter;
|
||||
use LIT\MCP\Integrations\Divi\Release\Manifest;
|
||||
use WP_Error;
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
/**
|
||||
* Adapter for Divi's role editor (E3, E15): et_pb_is_allowed() (Divi 5.2.1 builder/core.php:1128)
|
||||
* Adapter "Bibliothek" (spec §3) for Divi's role editor (E3, E15): et_pb_is_allowed() (Divi's builder/core.php)
|
||||
* answers for the current user's role, "dangerous" options (theme_builder,
|
||||
* read_dynamic_content_custom_fields) default to off for every role but administrator. When
|
||||
* Divi no longer has the function, nothing is allowed – DiviCompatibility reports it.
|
||||
* Not final so tests can pass a check.
|
||||
*/
|
||||
class DiviRoles
|
||||
class DiviRoles implements DiviAdapter
|
||||
{
|
||||
private const LABELS = [
|
||||
'divi_library' => 'Divi-Bibliothek',
|
||||
@@ -28,6 +31,11 @@ class DiviRoles
|
||||
'theme_builder' => 'Theme Builder',
|
||||
];
|
||||
|
||||
public static function manifest(): Manifest
|
||||
{
|
||||
return new Manifest(Manifest::LIBRARY, calls: [new Call('et_pb_is_allowed', 1)]);
|
||||
}
|
||||
|
||||
/** @param (Closure(string): bool)|null $check Test seam; null = Divi's et_pb_is_allowed(). */
|
||||
public function __construct(private ?Closure $check = null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user