For a Joomla 4 project I wrote a Content Plugin to grab video thumbs from Video-URLs (Vimeo) the user adds into Custom form field of a frontend form. The following code successfully gets the video thumbnail onContentBeforeSave(). But the manipulated $data object which holds all the form data, seems not get saved to the database. How to make sure the manipulated $data object gets saved properly?
class PlgContentVideothumbgrabber extends CMSPlugin { public function onContentBeforeSave($context, $article, $isNew, $data) { if(!in_array($context, array('com_content.form'))) { return true; } $vimeo = $data['com_fields']['pa-video-vimeo']; $thumbnail = $this->_grab_vimeo_thumbnail($vimeo, 'HIGH'); // The $thumbnail holds video thumbnail correctly here. // How to save the manipulated $data object to database? $data['com_fields']['pa-video-screenshot'] = $thumbnail; return true; } public static function _grab_vimeo_thumbnail($vimeo_url, $thumbNamilQuality = '') { ... } ... }