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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

adriancid created an issue. See original summary.

Chirag_Garg’s picture

FileSize
20.87 KB

Hi @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.

Chirag_Garg’s picture

Assigned: Unassigned » Chirag_Garg
Chirag_Garg’s picture

Status: Active » Reviewed & tested by the community
adriancid’s picture

Status: Reviewed & tested by the community » Active

Changing to active as I need to check this again.

hrodrig’s picture

Confirmed that this does not work with the new Claro administration theme.

Add content admin display

hrodrig’s picture

Issue summary: View changes
lauriii’s picture

This 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?

adriancid’s picture

@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.

adriancid’s picture

Assigned: Chirag_Garg » Unassigned
eatings’s picture

Version: 7.x-1.x-dev » 8.x-1.x-dev

Updating the issue to reflect this happens on 8.x branch, specifically.

sonvir249’s picture

Assigned: Unassigned » sonvir249
Issue summary: View changes
Status: Active » Needs review
FileSize
1.77 KB

Hi @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.

adriancid’s picture

Status: Needs review » Active

Hi @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.

adriancid’s picture

juanolalla’s picture

The 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.

  • adriancid committed 9f96c0c on 8.x-1.x authored by juanolalla
    Issue #3029598 by sonvir249, juanolalla, Chirag_Garg: When a theme...
adriancid’s picture

Status: Needs review » Fixed
adriancid’s picture

Thanks @juanolalla for the patch

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

adriancid’s picture