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.
		
		
		
		
			
				
					47 lines
				
				1.0 KiB
			
		
		
			
		
	
	
					47 lines
				
				1.0 KiB
			| 
											7 years ago
										 | <?php
 | ||
|  | 
 | ||
|  | namespace common\modules\banners\forms;
 | ||
|  | 
 | ||
|  | use common\modules\banners\entities\BannerPlace;
 | ||
|  | use yii\base\Model;
 | ||
|  | use Yii;
 | ||
|  | 
 | ||
|  | class BannerPlaceForm extends Model
 | ||
|  | {
 | ||
|  |     public $title;
 | ||
|  |     public $width;
 | ||
|  |     public $height;
 | ||
|  |     public $active;
 | ||
|  | 
 | ||
|  |     public $_place;
 | ||
|  | 
 | ||
|  |     public function __construct(BannerPlace $place = null, $config = [])
 | ||
|  |     {
 | ||
|  |         if ($place) {
 | ||
|  |             $this->title = $place->title;
 | ||
|  |             $this->width = $place->width;
 | ||
|  | 			$this->height = $place->height;
 | ||
|  | 			$this->active = $place->active;
 | ||
|  |             $this->_place = $place;
 | ||
|  |         }
 | ||
|  |         parent::__construct($config);
 | ||
|  |     }
 | ||
|  | 
 | ||
|  |     public function rules(): array
 | ||
|  |     {
 | ||
|  |         return [
 | ||
|  |             [['title'], 'required'],
 | ||
|  |             [['width', 'height', 'active'], 'integer'],
 | ||
|  |         ];
 | ||
|  |     }
 | ||
|  | 
 | ||
|  | 	public function attributeLabels() {
 | ||
|  | 		return [
 | ||
|  | 			'id' => Yii::t('banners', 'ID'),
 | ||
|  | 			'title' => Yii::t('banners', 'Title'),
 | ||
|  | 			'width' => Yii::t('banners', 'Width'),
 | ||
|  | 			'height' => Yii::t('banners', 'Height'),
 | ||
|  | 			'active' => Yii::t('banners', 'Status'),
 | ||
|  | 		];
 | ||
|  | 	}
 | ||
|  | }
 |