Allow modules to provide flags.
This commit is contained in:
parent
55a0200e88
commit
0eb2d5fd61
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Hooks provided by farm_flags.
|
||||
*
|
||||
* This file contains no working PHP code; it exists to provide additional
|
||||
* documentation for doxygen as well as to document hooks in the standard
|
||||
* Drupal manner.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup farm_flags Farm flag module integrations.
|
||||
*
|
||||
* Module integrations with the farm_flags module.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup farm_flags_hooks Farm flag's hooks
|
||||
* @{
|
||||
* Hooks that can be implemented by other modules in order to extend farm_flags.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provide a list of flags that can be applied to records for filtering.
|
||||
*
|
||||
* @return array
|
||||
* Returns an associative array of flags, with machine name and translatable.
|
||||
*/
|
||||
function hook_farm_flags() {
|
||||
return array(
|
||||
'priority' => t('Priority'),
|
||||
'review' => t('Needs Review'),
|
||||
'organic' => t('Organic'),
|
||||
'notorganic' => t('Not Organic'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
|
@ -4,9 +4,21 @@
|
|||
* Farm flags module.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get a list of available flags.
|
||||
*/
|
||||
function farm_flags_list() {
|
||||
|
||||
// Ask modules for flags.
|
||||
$flags = module_invoke_all('farm_flags');
|
||||
|
||||
// Return them.
|
||||
return $flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allowed values callback function for the flags field.
|
||||
*/
|
||||
function farm_flags_field_allowed_values() {
|
||||
return array();
|
||||
return farm_flags_list();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue