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.

50 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
{
3 years ago
public ?string $name = null;
public ?string $title = null;
public ?int $status = null;
3 years ago
public Language $language;
public function __construct(Language $language = null, $config = [])
{
if ($language) {
$this->name = $language->name;
$this->title = $language->title;
$this->status = $language->status;
3 years ago
$this->language = $language;
}
parent::__construct($config);
}
public function rules(): array
{
return [
[['title', 'name'], 'required'],
[['status'], 'integer'],
[['name'], 'string', 'max' => 2],
[['title'], 'string', 'max' => 64],
];
}
3 years ago
public function attributeLabels(): array
{
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'),
];
}
}