0

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?

5
  • 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?
    – leymannx
    Oct 29 at 18:51
  • 1
    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
    – Clive
    Oct 29 at 18:52
  • 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. Oct 29 at 19:13
  • 1
    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
    – Clive
    Oct 29 at 19:40
  • I see. Another question, is there a way to create the view, and edit it programmatically in a custom module? Oct 29 at 20:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.