# Custom configuration form error

**URL:** <https://forum.mautic.org/t/custom-configuration-form-error/22852>\
**Category:** Development\
**Created:** [February 28, 2022, 6:22pm UTC](https://forum.mautic.org/t/custom-configuration-form-error/22852 "2022-02-28T18:22:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![NichMaia](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/nichmaia/32/6488_2.png) [@NichMaia](https://forum.mautic.org/u/NichMaia)\
**Post date:** [February 28, 2022, 6:22pm UTC](https://forum.mautic.org/t/custom-configuration-form-error/22852/1 "2022-02-28T18:22:24Z")

</div>

Hi, I’m trying to make a new plugin for mautic, following the documentation, but, the following error keeps popping up:

```auto
An error has occurred resolving the options of the form "MauticPlugin\ExampleBundle\Form\Type\ConfigAuthType": The option "integration" does not exist. Defined options are: "action", "allow_extra_fields", "allow_file_upload", "attr", "attr_translation_parameters", "auto_initialize", "block_name", "block_prefix", "by_reference", "compound", "constraints", "csrf_field_name", "csrf_message", "csrf_protection", "csrf_token_id", "csrf_token_manager", "data", "data_class", "disabled", "empty_data", "error_bubbling", "error_mapping", "extra_fields_message", "help", "help_attr", "help_html", "help_translation_parameters", "inherit_data", "invalid_message", "invalid_message_parameters", "label", "label_attr", "label_format", "label_translation_parameters", "mapped", "method", "post_max_size_message", "property_path", "required", "row_attr", "translation_domain", "trim", "upload_max_size_message", "validation_groups".

```

Can someone enlighten me as to why this is happening? Its my first project in mautic, so I can assume its something basic that I’m overlooking.

---

<div class="post-metadata">

**Author:** ![aerendir](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/aerendir/32/1050_2.png) [@aerendir](https://forum.mautic.org/u/aerendir)\
**Post date:** [March 1, 2022, 11:37am UTC](https://forum.mautic.org/t/custom-configuration-form-error/22852/2 "2022-03-01T11:37:42Z")

</div>

This is not an error related to Mautic but to Symfony.

You have to pass to the form the option `integration`, so the form knows that it is allowed:

> **[Forms (Symfony Docs)](https://symfony.com/doc/current/forms.html#passing-options-to-forms)**

---

<div class="post-metadata">

**Author:** ![NichMaia](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/nichmaia/32/6488_2.png) [@NichMaia](https://forum.mautic.org/u/NichMaia)\
**Post date:** [March 1, 2022, 1:07pm UTC](https://forum.mautic.org/t/custom-configuration-form-error/22852/3 "2022-03-01T13:07:59Z")

</div>

Thanks, so, the code would look something like this?

```auto
class ConfigAuthType extends AbstractType
{
    /**
     * {@inheritdoc}
     */
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder->add(
          'key',
          TextType::class,
          [
            'label' => 'hello_world.form.key',
            'required' => true,
            'attr' => [
              'class' => 'form-control',
            ],
          ]
        );
        $options = ['integration' => true];
    }
}

```

I’ve tried it and it still outputs the same error

---

<div class="post-metadata">

**Author:** ![aerendir](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/aerendir/32/1050_2.png) [@aerendir](https://forum.mautic.org/u/aerendir)\
**Post date:** [March 1, 2022, 1:34pm UTC](https://forum.mautic.org/t/custom-configuration-form-error/22852/4 "2022-03-01T13:34:56Z")

</div>

No, `ConfigAuthType::buildForm()` actually builds the form.

You have to add the method `ConfigAuthType::configureOptions()`.

Something like this:

```php
class ConfigAuthType extends AbstractType
{
    /**
     * {@inheritdoc}
     */
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        ...
    }

    public function configureOptions(OptionsResolver $resolver): void
    {
        $resolver->setDefaults([
            // ...,
            'integration' => true,
        ]);

        $resolver->setAllowedTypes('integration', 'bool');
    }
}

```

---

<div class="post-metadata">

**Author:** ![NichMaia](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/nichmaia/32/6488_2.png) [@NichMaia](https://forum.mautic.org/u/NichMaia)\
**Post date:** [March 1, 2022, 4:07pm UTC](https://forum.mautic.org/t/custom-configuration-form-error/22852/5 "2022-03-01T16:07:17Z")

</div>

That worked somewhat, but I ended up using another method to do my form, thanks anyways!

---

<div class="post-metadata">

**Author:** ![aerendir](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/aerendir/32/1050_2.png) [@aerendir](https://forum.mautic.org/u/aerendir)\
**Post date:** [March 2, 2022, 10:35am UTC](https://forum.mautic.org/t/custom-configuration-form-error/22852/6 "2022-03-02T10:35:30Z")

</div>

What you did?

---

<div class="post-metadata">

**Author:** ![NichMaia](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/nichmaia/32/6488_2.png) [@NichMaia](https://forum.mautic.org/u/NichMaia)\
**Post date:** [March 9, 2022, 1:08pm UTC](https://forum.mautic.org/t/custom-configuration-form-error/22852/7 "2022-03-09T13:08:16Z")

</div>

I ended up using the function “Append to form” in the integration class

```auto
public function appendToForm(&$builder, $data, $formArea)
    {
        if ($formArea == 'features') {
            $builder->add(
            'user_name',
                TextType::class,
                [
                    'label' => 'User ID',
                    'label_attr' => ['class' => 'control-label'],
                    'attr' => [
                        'class' => 'form-control',
                        'tooltip' => 'Insert a User ID',
                    ],
                    'empty_data' => ''
                ]
            );
    }

```
