Score:0

Is there a way to customize a ListBuilder for a specific node content type?

cn flag

I'm having trouble with listing nodes and content types. There are many different content types in my drupal site, and all of them are listed inside "contents" page (/admin/content). I can filter then by type, but it would be much better for every content type to have its own listing page.

The only way I've done admin listing pages in the past was with custom entities using EntityListBuilder. The problem I'm having the these nodes is that it seems I can't get every content type or bundle its own listbuilder.

Is there a easy way to create a listing page like the one in contents but for every content type?

leymannx avatar
ne flag
Why don't you simply create a view passing it an arg from the URL like /admin/content/% where % is the wildcard to get the content name from to be used in a contextual filter?
cn flag
It sounds like list builders would be unnecessarily complicated here - admin/content is a view, why not just edit it and add a new page with a contextual filter
Jean da Silva avatar
cn flag
probably it is the best way. Is it possible to create filters in the page also? I'm used to CakePHP for example to build webpages, not Drupal. The way views work is very strange to me.
cn flag
Yes filters are easy to add, if you edit the content view for example you can see how they're used/configured. Views does take a bit of getting used to if you're new to it, but it'll save you many hours of dev time when you know how to use it properly. If it's too much to learn too soon, a much simpler approach would be to add some links to the admin menu which go to a pre-filtered version of admin/content, e.g. /admin/content?type=article. Only drawbacks are you don't get to customise the page (title etc) and you have to maintain the links manually if content types are added/removed
Jean da Silva avatar
cn flag
I see. Another question, is there a way to create the view, and edit it programmatically in a custom module?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.