IchHabRecht / content_defender

Define allowed or denied content element types in your backend layouts
GNU General Public License v2.0
80 stars 35 forks source link

First Tab in NewContentElementWizard not selected #123

Open KlickUndKlar opened 1 year ago

KlickUndKlar commented 1 year ago

Hi @IchHabRecht

I just installed your great Extension and found a Problem with the new content element wizard.

In my case i've got a Backendlayout with the following config:

backend_layout {
        colCount = 1
        rowCount = 2
        rows {
          1 {
            columns {
              1 {
                name = LLL:EXT:myext/Resources/Private/Language/locallang_backend_layout.xlf:content.column.header
                colPos = 0
                maxitems = 1
                allowed {
                  CType = hero_text, hero_text_image, hero_text_video
                }
              }
            }
          }
          2 {
            columns {
              1 {
                name = LLL:EXT:myext/Resources/Private/Language/locallang_backend_layout.xlf:content.column.content
                colPos = 1
                disallowed {
                 CType = hero_text, hero_text_image, hero_text_video
                }
              }
            }
          }
        }
      }

If i open the new content element wizard in colPos = 1 the first tab is selected.

Bildschirm­foto 2023-02-04 um 00 18 19

If i open the new content element wizard in colPos = 0 there is no tab selected.

Bildschirm­foto 2023-02-04 um 00 18 43

Is this an issue of your extension or the TYPO3 Core?

Thanks for your help

Ben

KlickUndKlar commented 1 year ago

I found a solution, it's not the prettiest one, but it solves the problem.

[request.getQueryParams() ['colPos'] == 0]
    mod.wizards.newContentElement.wizardItems {
      hero_text.before = text
    }
[end]
kitzberger commented 9 months ago

I can confirm this issue with this setup here:

I debugged it down to the fact that my custom CEs are being grouped in a tab whose key is containing an underscore:

mod.wizards.newContentElement.wizardItems.my_mask_elements {
  header = My mask elements
  show = my_mask_element_1, my_mask_element_2
  ...
}

This seems to be a problem for how EXT:content_defender/Hooks/WizardItemsHook manipulates the wizard items.

After changing my_mask_elements to my-mask-elements everything is being processed correctly :partying_face: