Triger onContentAfterSave event in frontend view

32 views
Skip to first unread message

Bartosz Machnik

unread,
Oct 6, 2016, 12:58:29 PM10/6/16
to Joomla! General Development
Hello. I'm trying to triger onContentAfterSave event in frontend view. I add article by this code:

$new_article = new ContentModelArticle();
$data
= array('title' => 'title','introtext' => 'introtext');
$new_article
->save($data);



and it works fine but I need to triger onContentAfterSave event to run external plugins. I'm trying like this:

JPluginHelper::importPlugin( 'myplugingroup' );
$dispatcher
= JEventDispatcher::getInstance();
$results
= $dispatcher->trigger( 'onContentAfterSave', array('com_content.article', $data, true) );

print_r($results);
returns: "Array ( [0] => 1 [1] => 1 [2] => 1 )" but external plugin does not execute. Is there any error in my code? Has anybody got any example use of event triger that I can analyse?

Dmitry Rekun aka b2z

unread,
Oct 7, 2016, 1:58:20 AM10/7/16
to Joomla! General Development
Hi!

As far as I know you cannot trigger onContentAfterSave event for custom group plugins. It should be content group.

Dmitry

Troy Hall

unread,
Oct 11, 2016, 4:16:06 PM10/11/16
to joomla-de...@googlegroups.com
I'm not sure if I can explain this right, but if I have a repeatable
form field
$bob in fieldset "A"
can I use that value as an option for a field in fieldset "B" ?
for example..
fieldset=1
field = bob
textbox ( put your colors here )
end field
endfieldset

fieldset=2
field = colors
listbox
options =- bob[1],bob[2]bob[3] { etc }
end field
endfieldset

IF not is there another way to do this with a repeatable form field?

Bear
Reply all
Reply to author
Forward
0 new messages