Score:0

Access a Computed Field in Views

ru flag

I am trying to get the new version of Computed Fields to work on our site. It's working great, except I can't get it to be accessed in Views a field. In the README it explains that the new version has "computed field created by creating a computed field entity is always a bundle field, not a base field". Myself, and others, are talking to the module maintainer, but so far we haven't had much luck, so I thought I'd try here as well. Anyone have any idea how to access a bundle field as a regular field that can be used in Views.

Jaypan avatar
de flag
I've never used the module, but I create custom computed view plugins, and I believe to use them in Views you need to implement `hook_views_data()`. Maybe the module does not do this automatically, and you need to implement it yourself in a module.
ru flag
Computed bundle fields are not supported by Views. The corresponding issue is linked directly on the d.o module page itself. Example solution code needs 1 additional click: https://www.drupal.org/project/drupal/issues/2981047
TomP avatar
ru flag
I actually commented at drupal.org/project/drupal/issues/2981047. The problem there is there were so many posts, I can't figure out if any of the patches will work on Drupal 9.5.x site. If so, which one? Will hook_views_data() work on the new version bundle fields?
I sit in a Tesla and translated this thread with Ai:

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.