public function BakeryUserHooks::view in Bakery Single Sign-On System 8.2
File
- src/
BakeryUserHooks.php, line 121
Class
Namespace
Drupal\bakeryCode
public function view(UserInterface $account, &$build) {
if (!$this
->isMain()) {
$main_site = $this->config
->get('bakery_master');
$init_url = _bakery_init_field_url($account
->getInitialEmail());
if (parse_url($main_site, PHP_URL_HOST) == parse_url($init_url, PHP_URL_HOST)) {
$build['summary']['primary_profile'] = [
'#type' => 'item',
'#title' => t('Primary profile'),
// Take everything up to '/edit'.
// TODO Will this create a url correctly?
'link' => Link::fromTextAndUrl(t('Profile on primary site'), Url::fromUri(substr($init_url, 0, strlen($init_url) - 5)))
->toRenderable(),
'#access' => $this->currentUser
->hasPermission('access user profiles'),
];
}
}
}