How to unset field in views conditionally I'm using hook_views_pre_render() in a module to make sure an image field 'field_field_company_logo' is removed for a certain content type 'job_listing'. I have the following code, which works, but produces warnings:

function hideviewsfields_views_pre_render(&amp;$view) {
  if ( ($view-&gt;name == 'job_search') &amp;&amp; ($view-&gt;current_display == 'job_search_results') ) {
    $result = $view-&gt;result;
    foreach ($result as $row) {
      $type = $row-&gt;_field_data['nid']['entity']-&gt;type;
      if ( $type == 'job_listing' ) {
        unset ( $row-&gt;field_field_company_logo );
      }
    }
  }
}


It works, in as much as the correct images are omitted, but I get the following warnings:

Notice: Undefined property: stdClass::$field_field_company_logo in views_handler_field_field-&gt;get_items() (line 715 of /public_html/sites/all/modules/views/modules/field/views_handler_field_field.inc).
Warning: Invalid argument supplied for foreach() in views_handler_field-&gt;advanced_render() (line 1053 of /public_html/sites/all/modules/views/handlers/views_handler_field.inc).
Notice: Undefined property: stdClass::$field_field_company_logo in views_handler_field_field-&gt;get_items() (line 715 of /public_html/sites/all/modules/views/modules/field/views_handler_field_field.inc).
Warning: Invalid argument supplied for foreach() in views_handler_field-&gt;advanced_render() (line 1053 of /public_html/sites/all/modules/views/handlers/views_handler_field.inc).


I've seen elsewhere people writing code similar to the following:

unset($view-&gt;field[$field_name]);
unset($view-&gt;display_handler-&gt;handlers['field'][$field_name]);


where the first line seems similar to the unset I am executing, but I believe it was acting upon a different variable (i.e. not $views -- maybe $data?) and I can't find any other reference to the image field within the $view object that can be unset without it removing it altogether from the display.
Drill down in the field_field_company_logo field to its ['rendered']['#access'] property and set it's value to FALSE.