fix: global usages follow the Theme Builder access (ruling Q17 M1)
GlobalUsages gets the Theme Builder access injected as a closure (ThemeBuilderAccess::usageState(), wired at both construction sites through DiviIntegration::globalUsages()). Theme Builder posts are named only while the Theme Builder is visible to the account, otherwise only counted (also in blocked_ids); a global edit that changes them needs canUse(), a writable "Divi Theme Builder" group and edit_post. Without an injected access the fail-safe default checks what canUse() checks. The duplicate THEME_BUILDER_TYPES list gives way to DiviThemeBuilder::postTypes(). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
@@ -66,6 +66,20 @@ class ThemeBuilderAccess
|
||||
return ($this->visible === null || ($this->visible)()) && $this->canUse() === null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Theme Builder access of a global library edit (GlobalUsages, ruling Q17 M1, review I-2): visible = Theme
|
||||
* Builder posts may be named (visible()); usable = a global edit may change them – the rights of every Theme
|
||||
* Builder write (canUse(), part of visible()) and a writable group, as the Divi tools on layouts.
|
||||
*
|
||||
* @return array{visible: bool, usable: bool}
|
||||
*/
|
||||
public function usageState(): array
|
||||
{
|
||||
$visible = $this->visible();
|
||||
|
||||
return ['visible' => $visible, 'usable' => $visible && $this->writableGate() === null];
|
||||
}
|
||||
|
||||
public function writableGate(): ?WP_Error
|
||||
{
|
||||
if ($this->writable === null || ($this->writable)()) {
|
||||
|
||||
Reference in New Issue
Block a user