Uploaded image for project: 'Ibexa IBX'
  1. Ibexa IBX
  2. IBX-8720

taxonomy_entry_assignment_list block attribute passes all options to Form Type

    XMLWordPrintable

Details

    • Yes

    Description

       

      TaxonomyEntryAssignmentFormTypeMapper passes all options provided in the config to the FormType. Most mappers don't do this, they only passes on the options that the FormType actually supports. The exception is GenericFormTypeMapper when $mergeOptions parameter is used, ie:
       - integer
       - select
       - the activity_log block (Ibexa\Bundle\ActivityLog\Form\Type\ObjectClassChoiceType)
       - Users block (Ibexa\AdminUi\Form\Type\UserChoiceType)

      The other mappers only passes on the options that the FormType actually supports.

       

      final class TaxonomyEntryAssignmentFormTypeMapper implements AttributeFormTypeMapperInterface
      {
          public function map(...) {
              $definitionOptions = $blockAttributeDefinition->getOptions();
              $options = [];
      
              (...)
              return $formBuilder->create(
                  'value',
                  AttributeTaxonomyEntryAssignmentListType::class,
                  $options,
              );
      

      The current implementation prevents the use of custom options that are handled in custom code.

      So, the following config will cause exception due to the current implementation.

              vtaxonomy:
                  name: VTaxonomy
                  category: default
                  thumbnail: 'bundles/ibexafieldtypepage/images/thumbnails/embed.svg'
                  views:
                      default: { name: 'Default block layout', template: '@ibexadesign/blocks/vtaxonomy.html.twig', priority: -255 }
                  attributes:
                      taxonomy_entry_assignment_list:
                          type: taxonomy_entry_assignment_list
                          name: Tags
                          options:
                              taxonomy: tags
                              foobar_attribute: true
      

       

      Designs

        Attachments

          Activity

            People

              Unassigned Unassigned
              vidar.langseid@ibexa.co Vidar Langseid
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: