1

I started learning Drupal 8 this week. I followed this guide to create a new entity, which I then made available through REST using the following tutorial: https://drupalize.me/blog/201401/introduction-restful-web-services-drupal-8

CRUD operations on my entity work just fine. I can also issue my REST requests without any issues. What I'm trying to do now is fetch a list of all my entities via REST. From my understanding, I should create a view for that, but my entity doesn't show up in the view creation UI, so I can't. What do I have to do to make my entity show up there?

I'm not sure what code I should post, so don't hesitate to tell me what code you need to see.

3

You need to add a views_data handler, like this:

"views_data" = "Drupal\views\EntityViewsData"

That exposes your entity as views data.

That is the default implementation, which does a lot, but you might need to subclass that and extend the definitions if you need additional filters/fields/...

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.