1 user.theme.inc theme_user_permission_description($variables)

Returns HTML for an individual permission description.

Parameters

$variables: An associative array containing:

  • permission_item: An associative array representing the permission whose description is being themed. Useful keys include:

    • description: The text of the permission description.
    • warning: A security-related warning message about the permission (if there is one).

Related topics

File

core/modules/user/user.theme.inc, line 187
Theme functions for the User module.

Code

function theme_user_permission_description($variables) {
  $description = array();
  $permission_item = $variables['permission_item'];
  if (!empty($permission_item['description'])) {
    $description[] = '<div class="permission-description description table-filter-text-source">' . $permission_item['description'] . '</div>';
  }
  if (!empty($permission_item['restrict access'])) {
    $description[] = '<em class="permission-warning">' . t('Warning: Give to trusted roles only; this permission has security implications.') . '</em>';
  }
  if (!empty($permission_item['warning'])) {
    $description[] = '<a class="warning-toggle" href="#">more</a>';
    $description[] = '<div class="permission-warning-description">' . $permission_item['warning'] . '</div>';
  }
  if (!empty($description)) {
    return implode(' ', $description);
  }
}