function flag_flag_type_info_alter in Flag 7.3
Implements hook_flag_type_info_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_type_info() as normal.
File
- ./
flag.flag.inc, line 60 - Contains implementations of flag info hooks.
Code
function flag_flag_type_info_alter(&$definitions) {
foreach (entity_get_info() as $entity_type => $entity_info) {
// 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_info['configuration'])) {
// We deliberately exclude taxonomy vocabularies from the list of
// supported entity types because they aren't fieldable or directly
// viewable, which makes them impossible to flag.
if ($entity_type === 'taxonomy_vocabulary') {
continue;
}
$definitions[$entity_type] = array(
'title' => $entity_info['label'],
'description' => t('@entity-type entity', array(
'@entity-type' => $entity_info['label'],
)),
'handler' => 'flag_entity',
);
}
}
}