Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
When the site is configured to have the onlyone/add page and the seven theme is not used as administration theme the content types are not shown in the node/add page
Proposed resolution
Change the Add content admin page to display a list of content type titles linked to node/add/[content-type-title] with the summary underneath.
Remaining tasks
Find the problem.
1. The content label was not showing when I enabled this module.
2. The content link was showing incorrect it should be node/add/content-type but it was showing node/add
Create a patch.
User interface changes
None.
API changes
None.
Data model changes
None.
Test pages
node/add
Comment | File | Size | Author |
---|---|---|---|
#15 | onlyone-styling-tight-to-seven-markup-3029598-15.patch | 3.31 KB | juanolalla |
| |||
#12 | onlyone-content-label-not-showing-3029598-12-8.7.patch | 1.77 KB | sonvir249 |
|
Comments
Comment #2
Chirag_Garg CreditAttribution: Chirag_Garg commentedHi @adriancid
I was validating the issue. But was not able to verify. I had Bartik theme enabled but i was able to see the content types list.
Comment #3
Chirag_Garg CreditAttribution: Chirag_Garg commentedComment #4
Chirag_Garg CreditAttribution: Chirag_Garg commentedComment #5
adriancidChanging to active as I need to check this again.
Comment #6
hrodrig CreditAttribution: hrodrig as a volunteer commentedConfirmed that this does not work with the new Claro administration theme.
Comment #7
hrodrig CreditAttribution: hrodrig as a volunteer commentedComment #8
lauriiiThis problem is caused by the template override, which essentially prevents themes from providing their own markup. For that reason, the content type list is broken in all themes relying on their custom markup. Is there any other way to achieve the same or similar outcome than overriding the template?
Comment #9
adriancid@lauriii I think that when I made this functionality each admin theme has its own way to show this list (I believe that there was not a template for this page either.) I think this was the only way I found to make this works, but if you have another solution and you can help me I will add the patch without problems to the project.
Comment #10
adriancidComment #11
eatingsUpdating the issue to reflect this happens on 8.x branch, specifically.
Comment #12
sonvir249 CreditAttribution: sonvir249 as a volunteer and commentedHi @adriancid,
While validating this issue I found other issues.
1. The content label was not showing when I enabled this module.
2. The content link was showing incorrect it should be node/add/content-type but it was showing node/add
Adding the patch to resolve the above issues.
Comment #13
adriancidHi @sonvir249 thanks for the patch, can you open another different issue and add the steps to reproduce the bug? Then put there your patch and we will review the problem together, thanks.
Comment #14
adriancidComment #15
juanolalla CreditAttribution: juanolalla at Lullabot for DocuSign commentedThe purpose of customizing the node_add_list.html.twig template is to add the possibility to customize the message when the list is empty, specifically if we are using the "Show configured content types in a new menu entry" and then the list of content types configured to have only one content is empty, so that message would be different than Drupal core hardcoded one about no content types at all (https://www.drupal.org/project/drupal/issues/2965718).
Given that, I've just differentiated that case on the Controller, returning the custom message directly instead of using the template (we could even create a template for that, but I don't think it worth it, it's just text). The rest continues the same, but now we no longer need to customize the template, so it will work regardless of the theme.
Submitting patch.
Comment #17
adriancidComment #18
adriancidThanks @juanolalla for the patch
Comment #20
adriancid