You are here

function flag_field_handler_ops in Flag 5

Handler that prints the proper operations for a flag.

1 string reference to 'flag_field_handler_ops'
flag_views_tables in includes/flag.views.inc
Implementation of hook_views_tables

File

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

Code

function flag_field_handler_ops($fieldinfo, $fielddata, $value, $data) {
  $flag = flag_get_flag(NULL, $fieldinfo['fid']);
  $type = $data->{'flag_types_' . $flag->name . '_type'};
  $is_flagged = !is_null($value);
  if (!flag_access($flag) || !flag_content_enabled($flag, 'node', $type)) {

    // Flag does not apply to this user or node type.
    return;
  }
  if ($fielddata['options'] != '') {
    $flag->link_type = $fielddata['options'];
  }
  return $flag
    ->theme($is_flagged ? 'unflag' : 'flag', $data->nid);
}