[CORE][Posting] Add language choice field to the note posting block
This commit is contained in:
parent
44454ac28a
commit
0f358a9c5d
|
@ -28,6 +28,7 @@ use App\Core\DB\DB;
|
||||||
use App\Core\Event;
|
use App\Core\Event;
|
||||||
use App\Core\Form;
|
use App\Core\Form;
|
||||||
use App\Core\GSFile;
|
use App\Core\GSFile;
|
||||||
|
use function App\Core\I18n\_m;
|
||||||
use App\Core\Modules\Component;
|
use App\Core\Modules\Component;
|
||||||
use App\Core\Security;
|
use App\Core\Security;
|
||||||
use App\Entity\Actor;
|
use App\Entity\Actor;
|
||||||
|
@ -43,13 +44,12 @@ use App\Util\Exception\ServerException;
|
||||||
use App\Util\Formatting;
|
use App\Util\Formatting;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\FileType;
|
use Symfony\Component\Form\Extension\Core\Type\FileType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\LocaleType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||||
use Symfony\Component\HttpFoundation\File\Exception\FormSizeFileException;
|
use Symfony\Component\HttpFoundation\File\Exception\FormSizeFileException;
|
||||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||||
use Symfony\Component\Validator\Constraints\Length;
|
use Symfony\Component\Validator\Constraints\Length;
|
||||||
use function App\Core\I18n\_m;
|
|
||||||
use function count;
|
|
||||||
|
|
||||||
class Posting extends Component
|
class Posting extends Component
|
||||||
{
|
{
|
||||||
|
@ -94,17 +94,17 @@ class Posting extends Component
|
||||||
$form_params = [
|
$form_params = [
|
||||||
['to', ChoiceType::class, ['label' => _m('To:'), 'multiple' => false, 'expanded' => false, 'choices' => $to_tags]],
|
['to', ChoiceType::class, ['label' => _m('To:'), 'multiple' => false, 'expanded' => false, 'choices' => $to_tags]],
|
||||||
['visibility', ChoiceType::class, ['label' => _m('Visibility:'), 'multiple' => false, 'expanded' => false, 'data' => 'public', 'choices' => [_m('Public') => 'public', _m('Instance') => 'instance', _m('Private') => 'private']]],
|
['visibility', ChoiceType::class, ['label' => _m('Visibility:'), 'multiple' => false, 'expanded' => false, 'data' => 'public', 'choices' => [_m('Public') => 'public', _m('Instance') => 'instance', _m('Private') => 'private']]],
|
||||||
['content', TextareaType::class, ['label' => _m('Content:'), 'data' => $initial_content, 'attr' => ['placeholder' => _m($placeholder)], 'constraints' => [new Length(['max' => Common::config('site', 'text_limit')])],]],
|
['content', TextareaType::class, ['label' => _m('Content:'), 'data' => $initial_content, 'attr' => ['placeholder' => _m($placeholder)], 'constraints' => [new Length(['max' => Common::config('site', 'text_limit')])]]],
|
||||||
['attachments', FileType::class, [
|
['attachments', FileType::class, [
|
||||||
'label' => _m('Attachments:'),
|
'label' => _m('Attachments:'),
|
||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'invalid_message' => _m('Attachment not valid.'),
|
'invalid_message' => _m('Attachment not valid.'),
|
||||||
]
|
]],
|
||||||
]
|
['language', LocaleType::class, ['label' => _m('Note language:'), 'multiple' => false, 'default' => $user->getPreferredLanguageChoice()]],
|
||||||
];
|
];
|
||||||
|
|
||||||
if (count($available_content_types) > 1) {
|
if (\count($available_content_types) > 1) {
|
||||||
$form_params[] = ['content_type', ChoiceType::class,
|
$form_params[] = ['content_type', ChoiceType::class,
|
||||||
[
|
[
|
||||||
'label' => _m('Text format:'), 'multiple' => false, 'expanded' => false,
|
'label' => _m('Text format:'), 'multiple' => false, 'expanded' => false,
|
||||||
|
|
Loading…
Reference in New Issue