function views_attach_user in Views attach 6
Same name and namespace in other branches
- 6.2 views_attach.module \views_attach_user()
- 7.2 views_attach.module \views_attach_user()
Implementation of hook_user().
File
- ./
views_attach.module, line 45
Code
function views_attach_user($op, &$edit, &$account, $category = NULL) {
switch ($op) {
case 'view':
$views = views_attach_get_user_views($category);
foreach ($views as $info) {
$view = views_get_view($info['name']);
$view
->set_display($info['display']);
$args = $view->display_handler
->get_option('default_argument') === 'uid' ? array(
$account->uid,
) : array();
$result = $view
->execute_display($info['display'], $args);
if (!empty($result)) {
$account->content[$view->name . '_' . $info['display']] = array(
'#type' => 'user_profile_category',
'#weight' => $view->display_handler
->get_option('weight'),
'#title' => $view
->get_title(),
);
$account->content[$view->name . '_' . $info['display']]['content'] = array(
'#type' => 'markup',
'#value' => $result,
);
}
}
}
}