refactor: DesignRights::themeOptions() ohne ungenutzten DesignSystemWriter
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
0a24753b4d
commit
bfe6623fe8
@@ -79,10 +79,10 @@ final class DesignRights
|
||||
}
|
||||
|
||||
/**
|
||||
* Theme options (writing and restoring): edit_theme_options and Divi's role right "Theme-Anpassung". $writer is
|
||||
* not asked – Divi's customizer needs no Visual Builder; it keeps the signature of the other design rights.
|
||||
* Theme options (writing and restoring): edit_theme_options and Divi's role right "Theme-Anpassung". Divi's
|
||||
* customizer needs no Visual Builder, so no DesignSystemWriter is asked.
|
||||
*/
|
||||
public static function themeOptions(DesignSystemWriter $writer, ThemeOptionsAdapter $options): ?WP_Error
|
||||
public static function themeOptions(ThemeOptionsAdapter $options): ?WP_Error
|
||||
{
|
||||
$refusal = self::themeRight('Theme-Optionen ändern');
|
||||
if ($refusal !== null || $options->canCustomize()) {
|
||||
|
||||
@@ -29,7 +29,6 @@ final class DiviThemeOptionsUpdateAbility implements Ability, RequiresDiviFeatur
|
||||
private const BUILDER = 'Geänderte Schriften wirken auch im Divi-Builder (Standardschrift der Module).';
|
||||
|
||||
public function __construct(
|
||||
private DesignSystemWriter $writer,
|
||||
private ThemeOptionsAdapter $options,
|
||||
private FontCatalog $fonts,
|
||||
private DesignChange $change
|
||||
@@ -102,12 +101,12 @@ final class DiviThemeOptionsUpdateAbility implements Ability, RequiresDiviFeatur
|
||||
|
||||
public function permission(array $input): bool|WP_Error
|
||||
{
|
||||
return DesignRights::themeOptions($this->writer, $this->options) ?? true;
|
||||
return DesignRights::themeOptions($this->options) ?? true;
|
||||
}
|
||||
|
||||
public function execute(array $input): mixed
|
||||
{
|
||||
$refusal = DesignRights::themeOptions($this->writer, $this->options);
|
||||
$refusal = DesignRights::themeOptions($this->options);
|
||||
if ($refusal !== null) {
|
||||
return $refusal;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ final class ThemeOptionsRestorePlanner implements RestorePlanner
|
||||
{
|
||||
private const RESET = 'Theme-Optionen, die im Snapshot nicht gesetzt sind, kehren zum Divi-Standard zurück (%s).';
|
||||
|
||||
public function __construct(private DesignSystemWriter $writer, private ThemeOptionsAdapter $options)
|
||||
public function __construct(private ThemeOptionsAdapter $options)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ final class ThemeOptionsRestorePlanner implements RestorePlanner
|
||||
|
||||
public function rights(): ?WP_Error
|
||||
{
|
||||
return DesignRights::themeOptions($this->writer, $this->options);
|
||||
return DesignRights::themeOptions($this->options);
|
||||
}
|
||||
|
||||
/** Like lit/divi-theme-options-update: reads et_divi (ThemeOptionRead), writes it (ThemeOptionWrite). */
|
||||
|
||||
@@ -299,7 +299,7 @@ final class DiviIntegration implements Integration, Bootable
|
||||
new PresetRestorePlanner($this->designWriter, DesignRights::unfilteredHtml()),
|
||||
new ColorRestorePlanner($this->designWriter, $this->colorsAdapter),
|
||||
new VariableRestorePlanner($this->designWriter, $this->variablesAdapter),
|
||||
new ThemeOptionsRestorePlanner($this->designWriter, $this->themeOptionsAdapter)
|
||||
new ThemeOptionsRestorePlanner($this->themeOptionsAdapter)
|
||||
),
|
||||
new DiviPresetsAssignAbility(
|
||||
$this->designWriter,
|
||||
@@ -329,7 +329,6 @@ final class DiviIntegration implements Integration, Bootable
|
||||
),
|
||||
new DiviThemeOptionsGetAbility($this->themeOptionsAdapter),
|
||||
new DiviThemeOptionsUpdateAbility(
|
||||
$this->designWriter,
|
||||
$this->themeOptionsAdapter,
|
||||
$this->fontCatalog,
|
||||
$this->designChange()
|
||||
|
||||
Reference in New Issue
Block a user