In continuation of the implemented view->result usage (#350085: Linodef: Refactor Buttons API to use Views) I'm trying to enable the usage of the rendered view output so e.g. imagefield tags can be entered by clicking on an image thumb as requested here #665584: Select any field for view taglists. For realizing this the usage of hook_views_pre_render or view->execute=>alter=>view->render seems appropriate. The result array of the view object has to be altered since it is the only place where the object IDs like node id, term id etc (required for Linodef tags) are located.
However the file- and imagefields make trouble as they only provide the file id (fid) in the result array (e.g. textfields provide their actual content). The other approaches listed here don't work since no object ID for the current item is available:
- altering of the content of view fields by using their alter properties (see #690568: Alter fields on the fly (when loading a view))
- altering the rendered output by rendering the view manually (view->preview/view->render) and modifying that string (
view->render=>alter=>output) - theme overrides of theme_imagefield_*, theme_imagecache_* or of view templates is not possible at all since theme functions can only be overridden by themes and not by other modules
I'm continue searching for other possible approaches. Perhaps view handlers/plugins might be appropriate though with those approaches the creating of a special view/display for the taglist might be required (like e.g. img_assist does). In past I've done basic evaluation.
Comments
Comment #1
Roi Danton commentedAltering the result array is problematic with all fields that don't have their value to display stored. So not only file-/imagefield are affected but also node-/user-/viewreference fields (they are using node_id, user_id, view_id instead) or computed fields without db storage. So it would be better at all to alter the view->render output and not the view->result array. Maybe it works to store the view result in an array and using that array to alter the output. Since the view result heeds the filter, sorting and pager handlers this might work.