function farm_flags_load in farmOS 7
Helper function for loading a list of flags on an entity.
Parameters
$entity: The entity with flags on it (area, asset, or log).
Return value
array Returns an array of flag machine names.
2 calls to farm_flags_load()
- farm_flags_farm_area_details in modules/
farm/ farm_area/ farm_area.farm_area.inc - Implements hook_farm_area_details().
- farm_livestock_weight_group_report in modules/
farm/ farm_livestock/ farm_livestock_weight/ farm_livestock_weight.module - Generate Animal Weight Group Report
File
- modules/
farm/ farm_flags/ farm_flags.module, line 46 - Farm flags module.
Code
function farm_flags_load($entity) {
// Start with an empty array.
$flags = array();
// If there are flags, iterate through them and add them to the array.
if (!empty($entity->field_farm_flags[LANGUAGE_NONE])) {
foreach ($entity->field_farm_flags[LANGUAGE_NONE] as $value) {
if (!empty($value['value'])) {
$flags[] = $value['value'];
}
}
}
// Return the flags.
return $flags;
}