Hi, I am using Drupal 7 and Views 3. I have a view (named 'export') that generates csv export of selected node objects. However, I put some native code that displays all the fields contained in the selected node object and allows the user to select fields (via checkboxes) that they do not want to include in the export.
I tried to disable selected fields in hook_views_query_alter as follows:
function mymodule_views_query_alter (&$view, &$query) { if ($view->name == "export") { unset($query->fields['field_data_field_description_node_entity_type']); } }
Until this cancels this part of the array of fields, I still get the description field populated in the csv export. I'm just not good enough at the structure of views objects to fully understand how to remove a given field from a view. I searched the Internet for literally hours trying to find a message to shed light on this. Although I found many examples of using hook_views_query_alter to add filters or modify the WHERE clause of a query object, I did not find anything related to removing the columns returned by the view request. Any advice on this is greatly appreciated!
Thanks Axl
source share