fix: gespeichertes false (Divi-Standardschrift) gilt in Theme-Optionen get/update als nicht gesetzt
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
879ca752e7
commit
dab4a9ba2e
@@ -122,7 +122,8 @@ final class DiviThemeOptionsGetAbility implements Ability, RequiresDiviFeatures
|
||||
return $keys;
|
||||
}
|
||||
|
||||
$book = ThemeOptionBook::fromDivi($this->options->read());
|
||||
$stored = ThemeOptionBook::fromDivi($this->options->read());
|
||||
$book = $stored->withoutFalse();
|
||||
$rows = [];
|
||||
foreach ($keys as $key) {
|
||||
$definition = ThemeOptionSpec::definition($key);
|
||||
@@ -137,7 +138,7 @@ final class DiviThemeOptionsGetAbility implements Ability, RequiresDiviFeatures
|
||||
] + array_intersect_key($definition, array_flip(self::RULES));
|
||||
}
|
||||
|
||||
return ['options' => $rows, 'design_rev' => $book->rev(), 'notes' => self::NOTES];
|
||||
return ['options' => $rows, 'design_rev' => $stored->rev(), 'notes' => self::NOTES];
|
||||
}
|
||||
|
||||
/** Like lit/divi-design-system: whoever edits content may read the design. */
|
||||
|
||||
@@ -123,7 +123,7 @@ final class DiviThemeOptionsUpdateAbility implements Ability, RequiresDiviFeatur
|
||||
$this->name(),
|
||||
new ThemeOptionsArea($this->options),
|
||||
$input,
|
||||
fn (array $raw): DesignPlan|WP_Error => $this->plan(ThemeOptionBook::fromDivi($raw), $set)
|
||||
fn (array $raw): DesignPlan|WP_Error => $this->plan(ThemeOptionBook::fromDivi($raw)->withoutFalse(), $set)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -77,4 +77,10 @@ final class ThemeOptionBook
|
||||
{
|
||||
return self::fromDivi(array_diff_key($this->data, [$key => true]));
|
||||
}
|
||||
|
||||
/** Divi stores its default font as false: that is "not set" (W3), as ThemeOptionSpec::effective() sees it. */
|
||||
public function withoutFalse(): self
|
||||
{
|
||||
return self::fromDivi(array_filter($this->data, static fn (mixed $value): bool => $value !== false));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user