0

I am building a view with fivestar infos under the voting widget which look like this with the views preview:
views preview

But it is rendered without the infos in the page: enter image description here
In both cases I'm an admin user identified.
I notice that a whole div with the description class available in the views and including the average/total votes infos is not rendered in the final display.

Is there some configuration to do ? Permission don't seem to be the problem.

EDIT: So the main issue comes from the theme which is hardcoded from scratch and nothing is displayed unless it is willingly preprocessed or regenerated in a view. I found my way out (see below)

2

Have you gone to Display Manager /admin/structure/types/manage//display and played with those settings by the gear?

I normally setup display types like "default", "teaser", "teaser- icon side", etc. Then when I create a view, instead of outputting "fields", I output one of these pre-setup display types. I use Display Suite to help get more control of them.

I'm using this votingapi widget in D8 in this way and had no issues.

  • Thanks for helping out. I found another way, your solution couldn't apply because I ommitted to say (and I just edited my question) that the theme is fully hardcoded from scratch, and every display requires a preprocess function. I gave you a +1 anyway because your answer seems relevant and interesting for a none hardcoded drupal site. – Tritof Dec 12 '18 at 17:33
0

My way out:
For the node rendering: I used render($vars['content']['field_fivestar']['#items'][0]['count']) and render($vars['content']['field_fivestar']['#items'][0]['average']) in the template of the node. And then wrap it all in custom html and some if conditions.


For the views list rendering: I recreated the field using one field Fivestar with Rated format + Vote Results : Value based on a relationship 'Content : Vote Results' filtered on Number of votes on the Aggregation Function. Then I completed it with views conditional fields for the different plural / singular / empty alternatives

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.