1 layout.module layout_current_user_context()

Returns the current user account context, which is always available.

@since 1.17.5 Function added.

Return value

EntityLayoutContext: The layout context for the current user account.

File

core/modules/layout/layout.module, line 2117
The Layout module creates pages and wraps existing pages in layouts.

Code

function layout_current_user_context() {
  $current_user_context = layout_create_context('user', array(
    'name' => 'current_user',
    'label' => t('Logged-in user account'),
    'locked' => TRUE,
    'usageType' => LayoutContext::USAGE_TYPE_SYSTEM,
  ));
  $current_user_context->setData($GLOBALS['user']);

  return $current_user_context;
}