* @since 1.0 */ class StarRating extends InputWidget { /** * @inheritdoc */ public $pluginName = 'rating'; /** * @var array the list of inbuilt themes */ private static $_themes = ['krajee-fa', 'krajee-uni', 'krajee-svg']; /** * @inheritdoc */ public function run() { $this->initLanguage(); $this->registerAssets(); if ($this->pluginLoading) { Html::addCssClass($this->options, 'rating-loading'); } echo $this->getInput('textInput'); } /** * Registers the needed assets */ public function registerAssets() { $view = $this->getView(); $theme = ArrayHelper::getValue($this->pluginOptions, 'theme'); if (!empty($theme) && in_array($theme, self::$_themes)) { StarRatingThemeAsset::register($view)->addTheme($theme); } StarRatingAsset::register($view)->addLanguage($this->language, '', 'js/locales'); $this->registerPlugin($this->pluginName); } }