In order to make data show up when outputting Socialfield as a Field in Views, the option "Use field template" must be enabled under Style Settings. Is it possible to add native Views fields support?

Comments

Mihai Husar’s picture

Assigned: Unassigned » Mihai Husar
Status: Active » Needs review
jenlampton’s picture

Status: Needs review » Active

I don't see a patch here, not sure why this issue was marked needs review?

jenlampton’s picture

Assigned: Mihai Husar » Unassigned
Category: Feature request » Bug report
Status: Active » Needs review
StatusFileSize
new2.36 KB

I figured out what the issue is with views support.

In order for this field to render correctly in views, the socialfield_field_formatter_view() needs to return a render array with a key for each element. This way views can generate it's own results, and render them correctly. This module currently has it's own theme function that takes this render array (of a different structure) and renders it, but it only worked on fields.

In order to get this working in views I had to restructure the output of the render array. The end result looks the same, but it has significant markup changes. Generally, I don't like making markup changes in the same major version since that means when people update any CSS they'd written for those items will be broken.

So I'll just put this patch here, but I'll leave it up to you as to whether you want to include it as is, rework it, or add it in a new major version instead.

nikit’s picture

@jenlampton you provide only readme.txt changes.

Anonymous’s picture

Status: Needs review » Active

@jenlampton I agree with Nikit. This patch has not the code for views to work with socialfield.
Can you share the correct patch with us?

Putting status back to active.

hargobind’s picture

While searching through the issue queue, I came across this issue and decided to do some testing.

It appears that the bug that was reported in this issue is now fixed by the commit in #2655818: Function hook_field_formatter_view expects a renderable array for the $items starting from 0.

I'll close this issue since it seems to be resolved, but please reopen it if anyone experiences this bug again.