You are here

function flag_handler_field_ops::get_flag in Flag 7.2

Same name and namespace in other branches
  1. 6.2 includes/flag_handler_field_ops.inc \flag_handler_field_ops::get_flag()
  2. 6 includes/flag_handler_field_ops.inc \flag_handler_field_ops::get_flag()
  3. 7.3 includes/views/flag_handler_field_ops.inc \flag_handler_field_ops::get_flag()

Returns the flag object associated with our field.

A field is in some relationship. This function reaches out for this relationship and reads its 'flag' option, which holds the flag name.

3 calls to flag_handler_field_ops::get_flag()
flag_handler_field_ops::pre_render in includes/flag_handler_field_ops.inc
Find out if the flag applies to each item seen on the page. It's done in a separate DB query to to avoid complexity and to make 'many to one' tests (e.g. checking user roles) possible without causing duplicate rows.
flag_handler_field_ops::query in includes/flag_handler_field_ops.inc
Override base ::query(). The purpose here is to make it possible for the render() method to know two things: what's the content ID, and whether it's flagged.
flag_handler_field_ops::render in includes/flag_handler_field_ops.inc
Render the field.

File

includes/flag_handler_field_ops.inc, line 21
Contains the flag Ops field handler.

Class

flag_handler_field_ops
Views field handler for the Flag operations links (flag/unflag).

Code

function get_flag() {

  // When editing a view it's possible to delete the relationship (either by
  // error or to later recreate it), so we have to guard against a missing
  // one.
  if (isset($this->view->relationship[$this->options['relationship']])) {
    return $this->view->relationship[$this->options['relationship']]
      ->get_flag();
  }
}