/var/www/vhosts/nabawater/frontend/components
NameSizeModeActions
CActiveField.php97460644editdlrm
CActiveForm.php24460644editdlrm
CController.php44060644editdlrm
CmsDynamicRoute.php8510644editdlrm
Edit: /var/www/vhosts/nabawater/frontend/components/CActiveForm.php (2446B)
*/ class CActiveForm extends ActiveForm { /** * @var CActiveField */ public $fieldClass = CActiveField::class; /** * @var string */ public $successCssClass = 'success'; /** * @var */ private $model; /** * @param $model * @return $this */ public function setModel($model) { $this->model = $model; return $this; } /** * Runs the widget. * This registers the necessary JavaScript code and renders the form close tag. * * @return string|void * @throws \ReflectionException */ public function run() { if ($this->model !== null) { $modelName = ''; if ($this->model instanceof ActiveRecord) { $modelName = $this->model->tableName(); } else { if ($this->model instanceof Model) { $reflect = new \ReflectionClass($this->model); $modelName = Inflector::underscore($reflect->getShortName()); } } $modelName = array_map(function ($value) { return strtolower($value); }, explode('_', preg_replace('/[{}%]/', '', $modelName))); $modelName = implode('-', $modelName); if(empty($this->options['id'])){ $this->options['id'] = "$modelName-form"; } $this->options['data-validate'] = 'true'; } try { return parent::run(); } catch (InvalidCallException $e) { } } /** * @param \yii\base\Model $model * @param string $attribute * @param array $options * * @return CActiveField | \yii\widgets\ActiveField */ public function field($model, $attribute, $options = []) { if (array_key_exists('lang', $options)) { $attribute .= "[{$options['lang']}]"; unset($options['lang']); } return parent::field($model, $attribute, $options); } }