Wrong slug fields for siteroots (level > 1) in multidomain environment and no possibility to modify them
In a multidomain environment (where the sites are not located in the first level) the "is_siteroot" pages slugs are generated wrong. In addition, there is currently no possibility to manage them without directly modifying the slug in the database.
For example, if a new page is created in level 2, depending on the way it is created (wizard and from type of the parent from which executed) the slug field is shown in tca form. Even if slug is set to "/" here, "/1" or similar is saved instead. After that the field is not shown ony more at all.
Suggestion: At least when the created page is set to "is_siteroot", the slug should automatically bet set to "/".
Regarding multi language sites (like in my case), the behaviour should be checked, too. But it looks like the translated pages slug ist correctly set to "/".
I am using version 9.5.14.
- Root  -- Start  (Just for assigning some global TS, often use case) --- Domain A [is_siteroot + site configuration] -> Slug is set to "domaina" or (if set to "/" if form is shown) to "/1" --- Domain B [is_siteroos + site configuration] -> Slug is set to "domainb" or (if set to "/" if form is shown) to "/2"
#9 Updated by Riccardo De Contardi 9 days ago
Is this issue still present on latest master? Could you add a step-by-step guide about how to reproduce it?
In a configuration like the one in my attached file (Schermata 2020-03-29 alle 17.38.57.png) the slug field seems available and editable.
Am I missing something?
#10 Updated by Juan Manuel Vergés Solanas 6 days ago
I can reproduce this issue in 9.5.14 and I would say it persist in latest taking a look to the code.
Files affected are
This line should return '/' for the case described in the issue
However, is_siteroot is not populated nor in /backend/Classes/Controller/FormSlugAjaxController.php
neither sent in the ajax call done in /backend/Resources/Private/TypeScript/FormEngine/Element/SlugElement.ts
I would say that this could be fixed in SlugHelper.php doing an additional database request if isset( $recordData['is_siteroot'] ) == false if this issue can be reproduced in other scenarios.
If not, populating it in any of the 2 other files involved.
My scenario is slightly different: we have a is_siteroot inside a is_siteroot tree. The slug of the subtree is getting the whole path from the upper level tree instead of returning '/'
#11 Updated by Juan Manuel Vergés Solanas 6 days ago
I just found an easier fix
'fields' => ['title','is_siteroot']
However, as is_siteroot is a checkbox
<div class="checkbox checkbox-type-toggle">
<input type="checkbox" class="checkbox-input" value="1" data-formengine-input-name="data[pages][is_siteroot]" onclick="document.editform['data[pages][is_siteroot]'].value=this.checked?(document.editform['data[pages][is_siteroot]'].value|1):(document.editform['data[pages][is_siteroot]'].value&0);TBE_EDITOR.fieldChanged('pages','3089','is_siteroot','data[pages][is_siteroot]');" 1="" id="data_pages_3089_is_siteroot_0_5e851dae5f797895765675">
<label class="checkbox-label" for="data_pages_3089_is_siteroot_0_5e851dae5f797895765675">
<span class="checkbox-label-text"> </span>
the SlugElement.ts is not checking if it is checked and then returning always is_siteroot=1