Add accept property for file selection fields

This commit is contained in:
Visman 2020-09-10 15:46:08 +07:00
parent f045592a9b
commit 6cefed419e
2 changed files with 8 additions and 1 deletions

View file

@ -12,6 +12,12 @@ use function \ForkBB\__;
class Edit extends Profile
{
/**
* Паттерн для доступных к загрузке типов файлов
* @var string
*/
protected $accept = 'image/*';
/**
* Подготавливает данные для шаблона редактирования профиля
*
@ -349,6 +355,7 @@ class Edit extends Profile
\ForkBB\num($this->c->config->o_avatars_size),
\ForkBB\size($this->c->config->o_avatars_size)
),
'accept' => $this->accept,
];
}
$form['sets']['header'] = [

View file

@ -105,7 +105,7 @@
@elseif ('yield' === $cur['type'])
{!! $this->block($cur['value']) !!}
@elseif ('file' === $cur['type'])
<input @if ($cur['required']) required @endif @if ($cur['disabled']) disabled @endif @if ($cur['autofocus']) autofocus @endif class="f-ctrl" id="id-{{ $key }}" name="{{ $key }}" type="file">
<input @if ($cur['required']) required @endif @if ($cur['disabled']) disabled @endif @if ($cur['autofocus']) autofocus @endif class="f-ctrl" id="id-{{ $key }}" name="{{ $key }}" type="file" @if ($cur['accept']) accept="{{ $cur['accept'] }}" @endif>
@endif
@if ($cur['info'])
<p class="f-child4">{!! $cur['info'] !!}</p>