You are here

function farm_flags_wrap in farmOS 7

Wrap a flag string in a span.

Parameters

$string: The string to wrap.

$flag: The flag machine name.

Return value

string Returns the string wrapped in a span.

3 calls to farm_flags_wrap()
farm_flags_farm_area_details in modules/farm/farm_area/farm_area.farm_area.inc
Implements hook_farm_area_details().
farm_flags_preprocess_field in modules/farm/farm_flags/farm_flags.module
Implements hook_preprocess_field().
farm_flags_views_pre_render in modules/farm/farm_flags/farm_flags.module
Implements hook_views_pre_render().

File

modules/farm/farm_flags/farm_flags.module, line 124
Farm flags module.

Code

function farm_flags_wrap($string, $flag) {

  // Start an array of classes.
  $classes = array();

  // Add the flag itself as a class.
  $classes[] = check_plain($flag);

  // Allow other modules to alter the classes, or add their own.
  drupal_alter('farm_flags_classes', $flag, $classes);

  // Wrap the string and return it.
  return '<span class="' . implode(' ', $classes) . '">' . $string . '</span>';
}