public function init()
{
$this->validPlugins = [self::LIKE, self::SHARE, self::SEND, self::POST, self::VIDEO, self::FOLLOW, self::COMMENT, self::PAGE];
parent::init();
$this->setConfig('facebook');
if (empty($this->type)) {
throw new InvalidConfigException("The plugin 'type' must be set.");
}
if (empty($this->appId)) {
throw new InvalidConfigException("The Facebook 'appId' has not been set.");
}
if (!isset($this->noscript)) {
$this->noscript = Yii::t('kvsocial', 'Please enable JavaScript on your browser to view the Facebook {pluginName} plugin correctly on this site.', ['pluginName' => Yii::t('kvsocial', str_replace('fb-', '', $this->type))]);
}
$this->registerAssets();
if ($this->type === self::COMMENT && empty($this->settings['data-href'])) {
$this->settings['data-href'] = Yii::$app->request->getAbsoluteUrl();
}
$this->setPluginOptions();
echo "<div id='fb-root'></div>\n" . $this->renderPlugin();
}