You are here

function hook_farm_log_categories_populate in farmOS 7

Allow modules to automatically populate log categories in log forms. The category must exist already. Note that these will be passed through the t() function when they are added so that they can be translated. This does mean that they will only be translated once, to whatever the site's default language is.

Parameters

object $log: A log entity.

Return value

array Returns an array of log categories (as simple strings).

Related topics

5 functions implement hook_farm_log_categories_populate()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

farm_crop_farm_log_categories_populate in modules/farm/farm_crop/farm_crop.module
Implements hook_farm_log_categories_populate().
farm_equipment_farm_log_categories_populate in modules/farm/farm_equipment/farm_equipment.module
Implements hook_farm_log_categories_populate().
farm_livestock_farm_log_categories_populate in modules/farm/farm_livestock/farm_livestock.module
Implements hook_farm_log_categories_populate().
farm_soil_test_farm_log_categories_populate in modules/farm/farm_soil/farm_soil_test/farm_soil_test.module
Implements hook_farm_log_categories_populate().
farm_water_test_farm_log_categories_populate in modules/farm/farm_water/farm_water_test/farm_water_test.module
Implements hook_farm_log_categories_populate().
2 invocations of hook_farm_log_categories_populate()
farm_log_prepopulate_log_form_references in modules/farm/farm_log/farm_log.module
Helper function for populating entity reference fields in log forms.
farm_log_update_7008 in modules/farm/farm_log/farm_log.install
Autopopulate categories on certain log types.

File

modules/farm/farm_log/farm_log.api.php, line 53
Hooks provided by farm_log.

Code

function hook_farm_log_categories_populate($log) {
  $categories = array();
  if ($log->type == 'farm_water_test') {
    $categories[] = 'Water';
  }
  return $categories;
}