I created a plugin to send published articles data to external service
class plgSystemVacancypub extends JPlugin
{
public function onContentAfterSave($context, $article, $isNew)
{
// Get custom fields values
$customFieldnames = FieldsHelper::getFields('com_content.article', $article->get('id'), true);
$customFieldIds = array_map(create_function('$o', 'return $o->id;'), $customFieldnames);
$fmodel = JModelLegacy::getInstance('Field', 'FieldsModel', array('ignore_request' => true));
$customFieldValues= $fmodel->getFieldValues($customFieldIds , $article->get('id'));
// Send to external function
}
}
But in my article I have some custom fields. First saving the article the $customFieldValues
variable is empty. And when I click to Save article once again, custom fields are exists.
As I know the custom fields saves after article saving. How can I replace the subsequence of executing "save the custom fields" and my plugin? I want to see custom fields values on first publishing of article.