function blog_user_view in Blog 3.x
Same name and namespace in other branches
- 8.2 blog.module \blog_user_view()
Implements hook_ENTITY_TYPE_view().
File
- ./
blog.module, line 29 - Enables multi-user blogs.
Code
function blog_user_view(&$build, $account, $display, $view_mode) {
if ($account
->hasPermission('create blog_post content') && $display
->getComponent('blog__personal_blog_link')) {
// Build internal link based on router.
$url = Url::fromRoute('view.blog.blog_user_all', [
'arg_0' => $account
->id(),
]);
$internal_link = Link::fromTextAndUrl(t('View recent blog entries'), $url)
->toString();
$build['blog__personal_blog_link'] = [
'#type' => 'item',
'#title' => t('Blog'),
'#title_display' => 'invisible',
'#markup' => $internal_link,
'#attributes' => [
'class' => [
'blog',
],
],
];
}
}