Created
March 4, 2014 22:27
-
-
Save Greg-Boggs/9357106 to your computer and use it in GitHub Desktop.
Programmatically set a Drupal view argument based on the field of the current user.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @implements hook_views_pre_view(). | |
* @param $view | |
* @param $display_id | |
* @param $args | |
* | |
* Programmatically set a Drupal view argument based on the field of the current user. | |
*/ | |
function tng_weekly_view_views_pre_view(&$view, &$display_id, &$args) { | |
if($view->name == 'training_overview' && $display_id ='weekly_view') { | |
global $user; | |
$wrapper = entity_metadata_wrapper('user', $user); | |
$args[] = $wrapper->field_delta->value(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment