You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							48 lines
						
					
					
						
							1.1 KiB
						
					
					
				
			
		
		
	
	
							48 lines
						
					
					
						
							1.1 KiB
						
					
					
				| <?php | |
|  | |
| namespace common\modules\languages\forms; | |
|  | |
| use common\modules\languages\entities\Language; | |
| use yii\base\Model; | |
| use Yii; | |
|  | |
| class LanguageForm extends Model | |
| { | |
| 	public $name; | |
|     public $title; | |
|     public $status; | |
|  | |
|     public $_language; | |
|  | |
|     public function __construct(Language $language = null, $config = []) | |
|     { | |
|         if ($language) { | |
|         	$this->name = $language->name; | |
|             $this->title = $language->title; | |
|             $this->status = $language->status; | |
|  | |
|             $this->_language = $language; | |
|         } | |
|         parent::__construct($config); | |
|     } | |
|  | |
|     public function rules(): array | |
|     { | |
|         return [ | |
|             [['title', 'name'], 'required'], | |
|             [['status'], 'integer'], | |
|             [['name'], 'string', 'max' => 2], | |
| 	        [['title'], 'string', 'max' => 64], | |
|         ]; | |
|     } | |
|  | |
| 	public function attributeLabels() { | |
| 		return [ | |
| 			'id' => Yii::t('languages', 'ID'), | |
| 			'name' => Yii::t('languages', 'Name'), | |
| 			'title' => Yii::t('languages', 'Title'), | |
| 			'status' => Yii::t('languages', 'Status'), | |
| 			'default' => Yii::t('languages', 'Default'), | |
| 		]; | |
| 	} | |
| }
 | |
| 
 |