/**
* Triggered on Open Graph data preparation for contest, entry or category (view).
*
* @param string $context Event context.
* @param object $item Item: contest, entry or category.
* @param object $ogObject Object with Open Graph data.
* @param array $options Array of additional options like Twitter card types.
*/
public function onOpenGraphPrepare($context, $item, $ogObject, &$options)
{
if ($context != 'com_competition.competition'
&& $context != 'com_competition.participant'
&& $context != 'com_competition.category'
|| !\Joomla\CMS\Factory::getApplication()->app->isClient('site'))
{
return;
}
$ogObject->title = empty($item->title) ? $context : $item->title . ' - ' . $context;
$ogObject->description = 'onOpenGraphPrepare is working fine';
$options['twitter_card'] = 'summary_large_image';
}
onSaveRedirect
/**
* Triggered on entry or contest form save (controller).
* com_competition.appform - entry form context.
* com_competition.cform - contest form context.
*
* @param string $context Event context.
* @param string $url URL to redirect.
* @param string $msg System message to display.
* @param array $validData Validated form data.
*/
public function onSaveRedirect($context, &$url, &$msg, $validData)
{
if ($context != 'com_competition.appform'
&& $context != 'com_competition.cform'
|| !\Joomla\CMS\Factory::getApplication()->app->isClient('site'))
{
return;
}
$url = \Joomla\CMS\Uri\Uri::root();
$msg = 'onSaveRedirect is working fine for ' . $context;
}
onUserAuthorise
The event can be triggered anywhere in the component and allows the plugins to override JUser::authorise result in case it is not true. If the plugin returns true then action is allowed. Currently plugins can override only core.vote and core.unvote actions.
/**
* Event can be triggered anywhere in the component.
*
* @param object $user Reference to JUser object.
* @param string $action Name of the action to check for permission, like 'core.vote'.
* @param object $assetname Name of the asset on which to perform the action, like 'com_competition.competition.1'.
*/
public function onUserAuthorise($user, $action, $assetname)
{
// Allow action
return;
}