-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When dnadesign/silverstripe-elemental is installed, the "Select a content type" field is not available. #198
Comments
Hey @JamesDPC, thanks for raising this issue? I'm having a bit of trouble reproducing the problem - can you confirm whether |
When there is no 'ModelClass' param in the request URL, the modelClass is being set in ModelAdmin::init() using the array of available versioned models returned from ArchiveAdmin::getManagedModels(). https://github.com/silverstripe/silverstripe-admin/blob/1/code/ModelAdmin.php#L152 If I enable the file tab by turning 'keep_archived_assets' on in config, the File class is added at the start of the managed models when /admin/archive/?others=1 is requested and is set as the modelClass for the request. I think the problem lies here: Both BaseElement and File have a method getArchiveField via the extension in the versioned-admin module, so the Content Type field is never added to the form. |
Thanks for the additional details, @JamesDPC. I can definitely reproduce the issue when Either way, there's definitely an issue with the logic here. |
PR merged. This will be automatically tagged by GitHub actions. |
Hi
Per the subject, when the dnadesign/silverstripe-elemental and the "Blocks" tab is available in the Archives admin, the "Other" tab is available but does not show the "Select a content type" field. Instead, the others tab shows a list of all versioned dataobjects excluding SiteTree records.
With the "blocksarchive" configuration enabled (default) in archive-admin.yml:
With the "blocksarchive" configuration removed in archive-admin.yml, we see the field:
The culprit seems to be that the model class when the "Other" tab is active Is
DNADesign\Elemental\Models\BaseElement
(https://github.com/silverstripe/silverstripe-versioned-admin/blob/1/src/ArchiveAdmin.php#L68)
This blocks the "getOtherModelSelectorField" from returning the content type selection field.
A possible fix is to ensure the modelClass value is empty when the Other tab is active ? Another is to simply default to the "Select a Content Type" field and provide the Pages, Files, Blocks selection in that field, rather than via tabs. Maybe defaulting to the first that is available depending on the modules installed.
Our workaround for this at the moment is an extension for the ArchiveAdmin to ensure the field returned from
getOtherModelSelectorField
is pushed onto the form in updateEditForm. This allows our content editors to filter the "Other" records.Versions:
SS: 4.6,4.7
Version: 1.6,1.7.2
Thanks!
James
PR
The text was updated successfully, but these errors were encountered: