You are here

function flag_flag::replace_tokens in Flag 7.3

Same name and namespace in other branches
  1. 5 flag.inc \flag_flag::replace_tokens()
  2. 6.2 flag.inc \flag_flag::replace_tokens()
  3. 6 flag.inc \flag_flag::replace_tokens()
  4. 7.2 flag.inc \flag_flag::replace_tokens()

Replaces tokens in a label. Only the 'global' token context is recognized by default, so derived classes should override this method to add all token contexts they understand.

2 calls to flag_flag::replace_tokens()
flag_entity::replace_tokens in includes/flag/flag_entity.inc
Replaces tokens.
flag_flag::get_label in includes/flag/flag_flag.inc
Processes a flag label for display. This means language translation and token replacements.
1 method overrides flag_flag::replace_tokens()
flag_entity::replace_tokens in includes/flag/flag_entity.inc
Replaces tokens.

File

includes/flag/flag_flag.inc, line 1222
Contains the flag_flag class. Flag type classes use an object oriented style inspired by that of Views 2.

Class

flag_flag
This abstract class represents a flag, or, in Views 2 terminology, "a handler".

Code

function replace_tokens($label, $contexts, $options, $entity_id) {
  if (strpos($label, 'flagging:') !== FALSE) {
    if ($flagging = $this
      ->get_flagging($entity_id)) {
      $contexts['flagging'] = $flagging;
    }
  }
  return token_replace($label, $contexts, $options);
}