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.

49 lines
1.2 KiB

6 years ago
<?php
namespace common\modules\banners\forms;
use common\modules\banners\entities\BannerPlace;
use yii\base\Model;
use Yii;
class BannerPlaceForm extends Model
{
3 years ago
public ?string $title = null;
public ?int $width = null;
public ?int $height = null;
public ?int $active = null;
6 years ago
3 years ago
public BannerPlace $place;
6 years ago
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;
3 years ago
$this->place = $place;
6 years ago
}
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'),
];
}
}