BcFreezeHelper::select PHP Method

select() public method

select プルダウンメニューを表示
public select ( string $fieldName, array $options = [], array $attributes = [] ) : string
$fieldName string フィールド文字列
$options array コントロールソース
$attributes array html属性 - $attributes['cols']が指定されている場合、値の文字の横幅を指定できる
return string $showEmpty htmlタグ
    public function select($fieldName, $options = array(), $attributes = array())
    {
        if ($this->freezed) {
            return $this->freezeControll($fieldName, $options, $attributes);
        } else {
            // 横幅を設定する
            // 指定した文字数より足りない文字数分スペースを埋める処理としている為、
            // 等幅フォントを設定しないとちゃんとした横幅にはならない
            if (!empty($attributes['cols'])) {
                foreach ($options as $key => $option) {
                    if ($attributes['cols'] > mb_strlen($option)) {
                        $pad = str_repeat(' ', $attributes['cols'] - mb_strlen($option));
                        $options[$key] = $option . $pad;
                    }
                }
            }
            return parent::select($fieldName, $options, $attributes);
        }
    }