You are here

function flag_flag::get_label in Flag 5

Same name and namespace in other branches
  1. 6.2 flag.inc \flag_flag::get_label()
  2. 6 flag.inc \flag_flag::get_label()
  3. 7.3 includes/flag/flag_flag.inc \flag_flag::get_label()
  4. 7.2 flag.inc \flag_flag::get_label()

Processes a flag label for display. This means language translation and token replacements.

You should always call this function and not get at the label directly. E.g., do `print $flag->get_label('title')` instead of `print $flag->title`.

Parameters

$label: The label to get, e.g. 'title', 'flag_short', 'unflag_short', etc.

$content_id: The ID in whose context to interpret tokens. If not given, only global tokens will be substituted.

Return value

The processed label.

1 call to flag_flag::get_label()
flag_flag::get_title in ./flag.inc
A convenience method for getting the flag title.

File

./flag.inc, line 524
Implements various flags. Uses 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 get_label($label, $content_id = NULL) {
  if (!isset($this->{$label})) {
    return;
  }
  $label = t($this->{$label});
  if (strpos($label, '[') !== FALSE && module_exists('token')) {
    $label = $this
      ->replace_tokens($label, array(
      'global' => NULL,
    ), $content_id);
  }
  return filter_xss_admin($label);
}