I want to display social share plugin in MediaStore component but my skills are not high enough to make it work. Can somebody give me some clues on how to do this?
This is how I tried to call the plugin:
jimport('joomla.plugin.plugin');
class plgMediaStoreJoomla extends JPlugin {
/**
* Constructor.
*
* @param $subject
* @param array $config
*/
function __construct(&$subject, $config = array()) {
// call parent constructor
parent::__construct($subject, $config);
}
/**
* onMSProductBeforeDisplay hook.
*/
public function onMSProductBeforeDisplay($context, &$item, &$params) {
JPluginHelper::importPlugin('content', 'social_share');
$dispatcher = JEventDispatcher::getInstance();
$app = JFactory::getApplication('site');
$app->initialise();
$app->triggerEvent('onContentAfterTitle');
$versions = $item->params->get('joomla_versions');
if (is_array($versions) && count($versions)) {
JHtml::_('stylesheet', 'plg_mediastore_joomla/style.css', array(), true);
$html = array();
$html[] = '<div class="joomla-versions">';
foreach ($versions as $version) {
$html[] = '<span class="joomla-' . $version . '">Joomla! ' . $version . '</span>';
}
$html[] = '</div>';
return implode("\n", $html);
}
return '';
}
But I get those errors:
Warning: Missing argument 1 for plgContentsocial_share::onContentAfterTitle() in..
Trying to get property of non-object in..
Notice: Undefined variable: context in..
etc