feat: Divi read tools accept library entries (library access, E1/E3)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -21,10 +21,17 @@ final class DiviPage
|
||||
public function __construct(
|
||||
public readonly WP_Post $post,
|
||||
public readonly Document $document,
|
||||
public readonly NodeIndex $index
|
||||
public readonly NodeIndex $index,
|
||||
private bool $libraryItem = false
|
||||
) {
|
||||
}
|
||||
|
||||
/** Whether the entry is a Divi Library entry (et_pb_layout), loaded through LibraryAccess. */
|
||||
public function isLibraryItem(): bool
|
||||
{
|
||||
return $this->libraryItem;
|
||||
}
|
||||
|
||||
public function treeRev(): string
|
||||
{
|
||||
return Rev::of((string) $this->post->post_content);
|
||||
@@ -40,7 +47,10 @@ final class DiviPage
|
||||
|
||||
public function editUrl(): string
|
||||
{
|
||||
return self::builderUrl($this->post);
|
||||
// A library entry has no public permalink (public: false); Divi's library list opens it here.
|
||||
return $this->libraryItem
|
||||
? (string) get_edit_post_link($this->post, 'raw')
|
||||
: self::builderUrl($this->post);
|
||||
}
|
||||
|
||||
/** The entry opened in the Divi Visual Builder – the edit_url of every Divi write (review I-1). */
|
||||
|
||||
Reference in New Issue
Block a user