I have follow code for after save:
public function onContentAfterSave ($context, $article, $isNew)
{
$article = JModelLegacy::getInstance('Article', 'ContentModel')->getItem();
....
}
It works fine if I save an article.
But it will execute too if I save other things like a Weblink, so there comes the error measage:
Call to a member function getItem() on boolean
Now I'am look for a rule to check that the code only execute by save an article like
public function onContentAfterSave ($context, $article, $isNew)
{
if (IS_A_ARTCLE) { ... }
}