/** * Initializes the widget. */ public function init() { TbArray::defaultValue('successClass', 'success', $this->pluginOptions); TbArray::defaultValue('errorClass', 'error', $this->pluginOptions); if (!isset($this->assetPath)) { $this->assetPath = Yii::getPathOfAlias('vendor.guillaumepotier.parsleyjs.dist'); } if (!$this->bindPlugin) { $this->htmlOptions['data-plugin'] = 'parsley'; $this->htmlOptions['data-plugin-options'] = CJSON::encode($this->pluginOptions); } parent::init(); }
/** * Initializes CiiActiveForm * * CiiActiveForm provides a number of enhanced functionalities and tools that wouldn't otherwise be provided, such as HTML5 elements * However it's primary benefit comes from using CiiSettingsModel via the dashboard. While use in the dashboard is recommended, it can * be used outside of that. However for the sake of extensibility it needs to be a part of Cii itself so that it can be used elsewhere * within the application by developers if they so choose to use it. * * @see CActiveForm::init() */ public function init() { $asset = Yii::app()->assetManager->publish(YiiBase::getPathOfAlias('application.extensions.cii.assets'), true, -1, YII_DEBUG); $cs = Yii::app()->getClientScript(); if ($this->registerPureCss) { $cs->registerCssFile($asset . '/css/pure.css'); } if ($this->registerPrism) { $cs->registerCssFile($asset . '/prism/prism-light.css'); $cs->registerScriptFile($asset . '/prism/prism.js', CClientScript::POS_END); } return parent::init(); }
public function init() { $assets = Yii::app()->getAssetManager()->publish(dirname(__FILE__) . '/assets'); Yii::app()->clientScript->registerScriptFile($assets . '/js/modelForm.js'); Yii::app()->clientScript->registerPackage('modelForm'); Yii::app()->clientScript->registerPackage('jquery.ui'); Yii::app()->clientScript->registerPackage('jquery'); Yii::app()->clientScript->registerPackage('cookie'); Yii::app()->clientScript->registerScript('yiiParams', ' var yiiParams = ' . json_encode(Yii::app()->params->toArray()) . '; ', CClientScript::POS_HEAD); if (!$this->fromModel && $this->model instanceof IFileBased) { echo $this->upload('id'); } if (!$this->fromModel) { $this->htmlOptions['onsubmit'] = 'return modelFormSubmit();'; } $this->htmlOptions['isNew'] = (int) (!$this->model->id); parent::init(); }
/** * Initializes the widget. * This renders the form open tag. */ public function init() { // modal-form for popups if (Yii::app()->request->isAjaxRequest) { if (!isset($this->htmlOptions['class'])) { $this->htmlOptions['class'] = ''; } $this->htmlOptions['class'] .= ' modal-form'; } // get a model we can use for this form $this->model = $this->model ? $this->model : new YdActiveFormModel(); // init the parent (output <form> tag) parent::init(); // output the return url if ($this->returnUrl !== false) { echo CHtml::hiddenField('returnUrl', $this->returnUrl ? $this->returnUrl : Yii::app()->returnUrl->getFormValue()); } // ask to save work if ($this->askToSaveWork) { Yii::app()->controller->widget('widgets.AskToSaveWork', array('watchElement' => '#setting-form :input', 'message' => Yii::t('dressing', 'Please save before leaving the page.'))); } }
public function init() { $this->htmlOptions = array_merge(array('class' => 'well'), $this->htmlOptions); parent::init(); }