You are here

function flag_handler_relationship::get_flag in Flag 6.2

Same name and namespace in other branches
  1. 7.3 includes/views/flag_handler_relationships.inc \flag_handler_relationship::get_flag()
  2. 7.2 includes/flag_handler_relationships.inc \flag_handler_relationship::get_flag()

Returns the flag object.

3 calls to flag_handler_relationship::get_flag()
flag_handler_relationship_content::query in includes/flag_handler_relationships.inc
Called to implement a relationship in a query.
flag_handler_relationship_counts::query in includes/flag_handler_relationships.inc
Called to implement a relationship in a query.
flag_handler_relationship_user_content::query in includes/flag_handler_relationships.inc
Called to implement a relationship in a query.

File

includes/flag_handler_relationships.inc, line 54
Contains various relationship handlers.

Class

flag_handler_relationship
Base class for all our relationship classes.

Code

function get_flag() {

  // Backward compatibility: There may exist old views on the system whose
  // 'flag' option isn't set. (This happens if the admin had skippped
  // clicking the 'Update' button.) When run, these views should behave as
  // if the first flag was selected.
  if (!isset($this->options['flag'])) {
    $this->options['flag'] = flag_views_flag_default($this
      ->get_flag_type());
  }

  // Validation: Since validate() is called only when in Views's
  // administrative UI, we need to do validation at "run time" ourselves.
  if ($errors = $this
    ->validate()) {
    foreach ($errors as $error) {
      drupal_set_message($error, 'error');
    }
  }
  return flag_get_flag($this->options['flag']);
}