1.20.x layout.module layout_current_user_context()

Returns the current user context, which is always available.

@since 1.17.5 Function added.

Return value

EntityLayoutContext: The layout context for the current user.

File

modules/layout/layout.module, line 1950
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('Current user'),
    'locked' => TRUE,
    'usageType' => LayoutContext::USAGE_TYPE_SYSTEM,
  ));
  $current_user_context->setData($GLOBALS['user']);
  return $current_user_context;
}