/home/techb158/public_html/wp-content/plugins/kirki/app/Resources
Edit: /home/techb158/public_html/wp-content/plugins/kirki/app/Resources/PageContentResource.php (2485B)
ID;
if (!$stage_version) {
$stage_version = Page::get_most_recent_stage_version($page_id, false);
}
$this->stage_version = $stage_version;
$this->stage_block_key = Page::get_staged_meta_name(PageMetaKeys::BLOCKS, $page_id, $stage_version);
$page->load_missing([
'meta' => function (QueryBuilder $query) use ($page_id) {
$query->where_in('meta_key', [
PageMetaKeys::BLOCKS,
$this->stage_block_key
]);
}
]);
parent::__construct($page);
}
/**
* Convert the collection resource to an array.
*
* @return array The collection data as an associative array.
*/
public function to_array()
{
$page_url = PageUrl::create($this->resource);
$meta = isset($this->meta) ? $this->meta->pluck('meta_value', 'meta_key')->to_array() : [];
$content = get_the_content(null, false, PostUtil::get_wp_post($this->resource));
$blocks = !empty($meta[PageMetaKeys::BLOCKS]) ? $meta[PageMetaKeys::BLOCKS] : [];
if ($this->stage_version) {
$blocks = !empty($meta[$this->stage_block_key]) ? $meta[$this->stage_block_key] : [];
}
return [
'blocks' => !empty($blocks['blocks']) ? $blocks['blocks'] : null,
'content_length' => strlen($content),
'is_kirki_editor_mode' => Page::is_kirki_editor_mode($this->ID),
'preview_url' => $page_url->get_preview_url(),
'styles' => Page::get_page_styleblocks($this->ID, $this->stage_version),
'version_info' => Page::get_staged_version_info($this->ID, $this->stage_version),
];
}
}