You are here

function theme_userloginbar in UserLoginBar 8

Same name and namespace in other branches
  1. 5 userloginbar.module \theme_userloginbar()
  2. 7 userloginbar.module \theme_userloginbar()

Theming function for messages.

1 theme call to theme_userloginbar()
userloginbar::build in lib/Drupal/userloginbar/Plugin/Block/userloginbar.php
Implements \Drupal\block\BlockBase::blockBuild().

File

./userloginbar.module, line 44

Code

function theme_userloginbar() {
  $config = \Drupal::config('userloginbar.settings');
  drupal_add_css(drupal_get_path('module', 'userloginbar') . '/userloginbar.css');
  global $user;
  $output = '';
  if ($user
    ->id() and !$config
    ->get('disable_welcome_box')) {
    $output .= t('<p class="user-info">Hi !user, welcome back.</p>', array(
      '!user' => theme('username', array(
        'account' => $user,
      )),
    )) . '&nbsp';
    l(t('your account'), 'user/' . $user
      ->id(), array(
      'attributes' => array(
        'title' => t('Edit your account.'),
      ),
    )) . ' | &nbsp;';
    $output .= theme('item_list', array(
      'attributes' => array(
        'class' => 'welcome-box',
      ),
      'items' => array(
        l(t('Your account'), 'user/' . $user
          ->id(), array(
          'attributes' => array(
            'title' => t('Edit your account'),
          ),
        )) . '&nbsp|&nbsp',
        l(t('Sign out'), 'user/logout', array(
          'attributes' => array(
            'title' => t('Logout'),
          ),
        )),
      ),
    ));
  }
  return $output;
}