You are here

function flag_views_flag_default in Flag 6

Same name and namespace in other branches
  1. 6.2 includes/flag.views.inc \flag_views_flag_default()
  2. 7.3 includes/views/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.

3 calls to flag_views_flag_default()
flag_handler_relationship_content::option_definition in includes/flag_handler_relationships.inc
flag_handler_relationship_counts::option_definition in includes/flag_handler_relationships.inc
flag_handler_relationship_user_content::option_definition in includes/flag_handler_relationships.inc

File

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

Code

function flag_views_flag_default($content_type) {
  static $default_flag = array();
  if (!array_key_exists($content_type, $default_flag)) {
    $flag = array_shift(flag_get_flags($content_type));
    $default_flag[$content_type] = $flag ? $flag->name : NULL;
  }
  return $default_flag[$content_type];
}