I need to add a field to an existing View defined by another module. To make upgrades of that module easier, I'd prefer to modify the View using hooks rather than editing it directly through the UI. I understand how to use hook_views_pre_build or hook_views_query_alter to remove fields from a View, but what's the proper way to add fields to a View using hooks?

Comments

dawehner’s picture

Status: Active » Fixed

You can use $view->add_item for this. Look at existing fields what's the parameters for this.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.