How can I set an image_file attribute to a page programmatically? I’ve tried this:
$page_thumb_attr = $page->getAttribute('page_thumb');
$fid = is_object($page_thumb_attr) ? $this->getImageID() : 0;
$page_thumb = $fid > 0 ? File::getByID($fid) : null;
if (is_object($page_thumb)) {
$page->setAttribute('page_thumb', $page_thumb);
}
That doesn’t add the thumbnail to the page. It doesn’t even add the File Manger control button to the page edit. What am I missing?