function flag_flag_definitions_alter in Flag 7.2
Implements hook_flag_definitions_alter().
Step in and add flag types for any entities not yet catered for, using the basic flag_entity handler. This allows other modules to provide more specialized handlers for entities in hook_flag_definitions() as normal.
File
- ./
flag.inc, line 48 - Implements various flags. Uses object oriented style inspired by that of Views 2.
Code
function flag_flag_definitions_alter(&$definitions) {
foreach (entity_get_info() as $entity_type => $entity) {
// Only add flag support for entities that don't yet have them, and which
// are non-config entities.
if (!isset($definitions[$entity_type]) && empty($entity['configuration'])) {
$definitions[$entity_type] = array(
'title' => $entity['label'],
'description' => t('@entity-type entity', array(
'@entity-type' => $entity['label'],
)),
'handler' => 'flag_entity',
);
}
}
}