1 views_handler_field_user_roles.inc views_handler_field_user_roles::add_self_tokens(&$tokens, $item)

Add any special tokens this field might use for itself.

This method is intended to be overridden by items that generate fields as a list. For example, the field that displays all terms on a node might have tokens for the tid and the term.

By convention, tokens should follow the format of [token-subtoken] where token is the field ID and subtoken is the field. If the field ID is terms, then the tokens might be [terms-tid] and [terms-name].

Overrides views_handler_field::add_self_tokens


core/modules/user/views/views_handler_field_user_roles.inc, line 51
Definition of views_handler_field_user_roles.


Field handler to provide a list of roles.


function add_self_tokens(&$tokens, $item) {
  if (!empty($item['role_label'])) {
    $tokens['[' . $this->options['id'] . '-role]'] = $item['role_label'];
    $tokens['[' . $this->options['id'] . '-name]'] = $item['role_name'];