et_header_layout, et_body_layout, et_footer_layout and et_template showing a
global entry now block a confirmed edit unless et_pb_is_allowed('theme_builder'),
like Divi's own check for TB layouts.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
75 lines
2.2 KiB
PHP
75 lines
2.2 KiB
PHP
<?php
|
||
|
||
declare(strict_types=1);
|
||
|
||
namespace LIT\MCP\Integrations\Divi\Library;
|
||
|
||
use Closure;
|
||
use LIT\MCP\ChangeLog\ChangeLog;
|
||
use LIT\MCP\Integrations\Divi\Design\DesignSystemReader;
|
||
use LIT\MCP\Integrations\Divi\Pages\DiviPageLoader;
|
||
use LIT\MCP\Integrations\Divi\Pages\DiviSaver;
|
||
use LIT\MCP\Integrations\Divi\Pages\DiviWriter;
|
||
use LIT\MCP\Integrations\Divi\Schema\DiviModules;
|
||
use LIT\MCP\Integrations\Integration;
|
||
|
||
defined('ABSPATH') || exit;
|
||
|
||
/**
|
||
* The group "Divi-Bibliothek" (E9): lit/library-list, lit/library-save and lit-library-insert (direct).
|
||
* Built by DiviIntegration::library() so it shares the library access (rights, Tools-tab gates –
|
||
* its id LibraryAccess::GROUP is what the P9 hiding and the write gate ask). Available with the
|
||
* Divi 5 builder, like the Divi group.
|
||
*/
|
||
final class LibraryIntegration implements Integration
|
||
{
|
||
/** @param (Closure(): bool)|null $diviWritable Whether lit/divi-insert is enabled (audit M2); null = always. */
|
||
public function __construct(
|
||
private LibraryAccess $access,
|
||
private DiviPageLoader $loader,
|
||
private DesignSystemReader $design,
|
||
private DiviWriter $writer,
|
||
private DiviSaver $saver,
|
||
private ChangeLog $log,
|
||
private DiviModules $modules,
|
||
private ?Closure $diviWritable = null
|
||
) {
|
||
}
|
||
|
||
public function id(): string
|
||
{
|
||
return LibraryAccess::GROUP;
|
||
}
|
||
|
||
public function label(): string
|
||
{
|
||
return __('Divi-Bibliothek', 'wp-lit-mcp');
|
||
}
|
||
|
||
public function isAvailable(): bool
|
||
{
|
||
return DiviModules::isAvailable();
|
||
}
|
||
|
||
public function abilities(): array
|
||
{
|
||
return [
|
||
new LibraryListAbility(
|
||
$this->access,
|
||
$this->loader,
|
||
$this->design,
|
||
new GlobalUsages(null, $this->access->roles())
|
||
),
|
||
new LibrarySaveAbility(
|
||
$this->access,
|
||
$this->loader,
|
||
$this->writer,
|
||
$this->saver,
|
||
$this->log,
|
||
$this->modules
|
||
),
|
||
new LibraryInsertAbility($this->writer, $this->access, $this->diviWritable),
|
||
];
|
||
}
|
||
}
|