Skip to content

Instantly share code, notes, and snippets.

@martsie
Created January 25, 2017 10:25
Show Gist options
  • Save martsie/7163da0a8e0e2cd84235971ed27ada53 to your computer and use it in GitHub Desktop.
Save martsie/7163da0a8e0e2cd84235971ed27ada53 to your computer and use it in GitHub Desktop.
Bad implementation of custom views fields in Drupal 7
<?php
/**
* DO NOT USE THIS CODE
*
* Substituting custom field content in views hooks is a great way
* to make enemies with future developers.
*/
function my_confusing_module_views_pre_render(&$view) {
// This is messy and hard to understand for site builders and future developers.
$view->result[0]->custom_field_999 = t('Foo');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment