You are here

function flag_views_flag_default in Flag 7.3

Same name and namespace in other branches
  1. 6.2 includes/flag.views.inc \flag_views_flag_default()
  2. 6 includes/flag.views.inc \flag_views_flag_default()
  3. 7.2 includes/flag.views.inc \flag_views_flag_default()

Helper function that gets the first defined flag and returns its name.

1 call to flag_views_flag_default()
flag_handler_relationship::get_flag in includes/views/flag_handler_relationships.inc
Returns the flag object.

File

includes/views/flag.views.inc, line 302
Provides support for the Views module.

Code

function flag_views_flag_default($entity_type) {
  $default_flag =& drupal_static(__FUNCTION__, array());
  if (!array_key_exists($entity_type, $default_flag)) {
    $flags = flag_get_flags($entity_type);
    $flag = array_shift($flags);
    $default_flag[$entity_type] = $flag ? $flag->name : NULL;
  }
  return $default_flag[$entity_type];
}