kartik\social\GooglePlugin::init PHP Method

init() public method

Initialize the widget
public init ( )
    public function init()
    {
        $this->validPlugins = [self::SIGNIN, self::PLUS_ONE, self::SHARE, self::FOLLOW, self::BADGE_PAGE, self::BADGE_PERSON, self::BADGE_COMMUNITY, self::HANGOUT, self::POST];
        parent::init();
        $this->setConfig('google');
        if ($this->type === self::SIGNIN && empty($this->clientId) && empty($this->options['data-clientid'])) {
            throw new InvalidConfigException("The Google 'clientId' must be set for the signin button.");
        }
        if ($this->type === self::FOLLOW && empty($this->pageId) && empty($this->options['data-href'])) {
            throw new InvalidConfigException("The Google 'pageId' must be set for the follow button.");
        }
        if ($this->type === self::BADGE_PAGE && empty($this->pageId) && empty($this->options['data-href'])) {
            throw new InvalidConfigException("The Google 'pageId' must be set for the page badge.");
        }
        if ($this->type === self::BADGE_PERSON && empty($this->profileId) && empty($this->options['data-href'])) {
            throw new InvalidConfigException("The Google 'profileId' must be set for the person badge.");
        }
        if ($this->type === self::BADGE_COMMUNITY && empty($this->communityId) && empty($this->options['data-href'])) {
            throw new InvalidConfigException("The Google 'communityId' must be set for the community badge.");
        }
        if (!isset($this->noscript)) {
            $this->noscript = Yii::t('kvsocial', 'Please enable JavaScript on your browser to view the Google {pluginName} plugin correctly on this site.', ['pluginName' => Yii::t('kvsocial', str_replace('ga-', '', $this->type))]);
        }
        $this->registerAssets();
        $this->setPluginOptions();
        $content = Html::tag($this->tag, '', $this->options);
        if ($this->type === self::SIGNIN) {
            $content = Html::tag($this->tag, $content, $this->signinOptions);
        }
        echo $content . "\n" . $this->renderNoScript();
    }