Form/PostType.php
public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $post = $options['data'];
        $builder
            ->add('body', CKEditorType::class, [
                'required' => false,
                'config' => ['toolbar' => 'basic'],
                'label' => 'post.form.body',
            ])
        ;

        // Add admin things if the user is an admin.
        if ($this->auth->isGranted('GROUP_ROLE_EDITOR', $this->context->getContext())) {
            $builder
                ->add('pinned', CheckboxType::class, [
                    'required' => false,
                    'label' => 'post.form.pinned',
                ])
                ->add('active', ChoiceType::class, [
                    // Show "unpublished" instead of active.
                    'choice_loader' => new CallbackChoiceLoader(function () use ($post) {
                        yield 'post.form.status_choices.active' => true;
                        if (!$post->isPublished()) {
                            yield 'post.form.status_choices.unpublished' => false;
                        } else {
                            yield 'post.form.status_choices.archived' => false;
                        }
                    }),
                    'label' => 'post.form.status',
                ])
                ->add('expiry', DateTimeType::class, [
                    'required' => false,
                    'time_widget' => 'single_text',
                    'date_widget' => 'single_text',
                    'label' => 'post.form.expiry',
                ])
            ;
        }
    }
public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $post = $options['data'];
        $builder
            ->add('body', CKEditorType::class, [
                'required' => false,
                'config' => ['toolbar' => 'basic'],
                'label' => 'post.form.body',
            ])
        ;

        // Add admin things if the user is an admin.
        if ($this->auth->isGranted('GROUP_ROLE_EDITOR', $this->context->getContext())) {
            $builder
                ->add('pinned', CheckboxType::class, [
                    'required' => false,
                    'label' => 'post.form.pinned',
                ])
                ->add('active', ChoiceType::class, [
                    // Show "unpublished" instead of active.
                    'choice_loader' => new CallbackChoiceLoader(function () use ($post) {
                        yield 'post.form.status_choices.active' => true;
                        if (!$post->isPublished()) {
                            yield 'post.form.status_choices.unpublished' => false;
                        } else {
                            yield 'post.form.status_choices.archived' => false;
                        }
                    }),
                    'label' => 'post.form.status',
                ])
                ->add('expiry', DateTimeType::class, [
                    'required' => false,
                    'time_widget' => 'single_text',
                    'date_widget' => 'single_text',
                    'label' => 'post.form.expiry',
                ])
            ;
        }
    }
{@inheritdoc}

@param FormBuilderInterface $builder The form builder.
@param array                $options The form options.

@return void