2021-03-14 07:42:01 +08:00

43 lines
1.3 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// +----------------------------------------------------------------------
// | Catch-CMS Design On 2020
// +----------------------------------------------------------------------
// | CatchAdmin [Just Like ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
// +----------------------------------------------------------------------
// | Author: JaguarJack [ njphper@gmail.com ]
// +----------------------------------------------------------------------
namespace catcher\library\form;
trait FormOptions
{
/**
* 是/否的选项
*
* @time 2021年03月06日
* @param array $label
* @param array $value
* @return array[]
*/
protected function yesOrNo(array $label = [], array $value = []): array
{
if (!count($label)) {
$label = ['是', '否'];
}
if (!count($value)) {
$value = [1, 2];
}
return [
['value' => $value[0], 'label' => $label[0]],
['value' => $value[1], 'label' => $label[1]],
];
}
}