/** * Initializes the widget * @throw InvalidConfigException */ public function init() { parent::init(); \Yii::setAlias('@xeditable', dirname(__FILE__)); $this->registerAssets(); //test }
/** * Initializes the widget */ public function init() { parent::init(); if ($this->social == self::FOLLOWER_GOOGLE) { $this->urlAPI = "https://www.googleapis.com/plus/v1/people/{$this->people}?key={$this->apiKey}"; } elseif ($this->social == self::FOLLOWER_FACEBOOK) { $this->urlAPI = "https://graph.facebook.com/{$this->people}?access_token={$this->fbAppId}|{$this->fbSecret}"; $this->attribute = 'likes'; } elseif ($this->social == self::FOLLOWER_YOUTUBE) { $this->urlAPI = "https://www.googleapis.com/youtube/v3/channels?part=statistics&id={$this->people}&key={$this->apiKey}"; $this->attribute = "subscriberCount"; } }
/** * @see register default assets for extension * */ public function registerDefaultAssets() { parent::init(); if (empty($this->defaults)) { $this->defaults = array(); } if (empty($this->defaults['mode'])) { $this->defaults['mode'] = $this->mode; } $defaults = Json::encode($this->defaults); XEditableAsset::register($this->view); $this->view->registerJs("\n\t\tif(\$.fn.editable)\n\t\t\$.extend(\n\t\t\t\$.fn.editable.defaults , {$defaults});\n\t\t\t/*\$.fn.editable.defaults.ajaxOptions = {\n\t\t\t\ttype: 'post',\n\t\t\t\tsuccess:function(data){\n\t\t\t\t\talert(data);\n\t\t\t\t}\n\t\t\t}*/\n\t\t"); }