Score:0

Programmatically create result row in views

ru flag

I have created a bunch of content types. Since I am using Drupal only for displaying results fetched from another service I was wondering if there is a way to display results in a view without actually having objects in the database?

For example, I get data from a certain endpoint and I want to display them in a table view. Is there a way to achieve that or would another approach be recommended?

Score:0
in flag

The short answer is No. Views is only capable of returning Content entities.

The approach I recommend is to use Feeds to import your data into custom entities. You can either define your own custom content entity, or use ECK to define a custom content entity via UI.

In our organization, we use this basic Feeds -> ECK -> Views approach all the time and it has the benefit of not requiring our support staff to know any PHP. You might also find the Ultimate Cron module to be useful if you need to retrieve data at a frequency shorter than one hour.

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.