初始化仓库
This commit is contained in:
55
admin/components/UI/Form/ChoiceColumn.php
Normal file
55
admin/components/UI/Form/ChoiceColumn.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace admin\components\UI\Form;
|
||||
|
||||
/**
|
||||
* 表格关联选择器列
|
||||
* @package backend\components\UI\Form
|
||||
*/
|
||||
class ChoiceColumn
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private array $column;
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param string $field
|
||||
* @return $this
|
||||
*/
|
||||
public function text(string $name, string $field): self
|
||||
{
|
||||
$this->column[] = [
|
||||
'name' => $name,
|
||||
'key' => $field,
|
||||
'type' => 'text'
|
||||
];
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param string $field
|
||||
* @return $this
|
||||
*/
|
||||
public function image(string $name, string $field): self
|
||||
{
|
||||
$this->column[] = [
|
||||
'name' => $name,
|
||||
'key' => $field,
|
||||
'type' => 'image'
|
||||
];
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getData(): array
|
||||
{
|
||||
return $this->column;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user