Created
March 18, 2017 17:05
-
-
Save anonymous/5f204bf020fac1c34b0dc85daa076423 to your computer and use it in GitHub Desktop.
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
function mytheme_preprocess_user(&$variables) { | |
if($variables['elements']['#view_mode'] == 'full') { | |
/** @var $target_user \Drupal\user\Entity\User */ | |
$target_user = $variables['user']; | |
$supported_projects_by_user_view = \Drupal\views\Views::getView('supported_projects_by_enlightaid_user'); | |
$supported_projects_by_user_view->get_total_rows = TRUE; | |
$supported_projects_by_user_view->execute('supported_projects_by_user_block'); | |
$variables['projects_supported'] = $supported_projects_by_user_view->render(); | |
$variables['num_projects_supported'] = $supported_projects_by_user_view->total_rows; | |
/** | |
* Now in user--full.html.twig | |
* {{projects_supported}} renders the view | |
* {{num_projects_supported}} is the total result of view | |
*/ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment