summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralexweber2013-02-07 20:52:17 (GMT)
committer Joachim Noreiko2013-02-07 20:52:17 (GMT)
commit5be70f8c74a6890fbc66015a476d2e3775239a38 (patch)
tree475aa810da98d9411920757b468d824b97b696d5
parentb38338fb84b05d535a323266c632a6c2c0ad83e4 (diff)
Issue #1905750 by alexweber: Added implementations of hook_flag_type_info() on behalf of non-required core modules.
-rw-r--r--flag.flag.inc39
1 files changed, 30 insertions, 9 deletions
diff --git a/flag.flag.inc b/flag.flag.inc
index 254b593..de98ad5 100644
--- a/flag.flag.inc
+++ b/flag.flag.inc
@@ -8,14 +8,17 @@
/**
* Implements hook_flag_type_info().
*
- * Defines the flag types this module implements.
+ * We define flag types for those Core entities we specifically cater for whose
+ * modules are required by Drupal core. Other core entities we cater for have
+ * their flag type defined in implementations of this hook on behalf of their
+ * providing modules, so that the entity's module is correctly picked up as a
+ * dependency.
*
* @return
* An "array of arrays", keyed by object type. The 'handler' slot
* should point to the PHP class implementing this flag.
*/
function flag_flag_type_info() {
- // Entity types we specifically cater for.
$definitions = array(
'node' => array(
'title' => t('Nodes'),
@@ -29,13 +32,31 @@ function flag_flag_type_info() {
),
);
- if (module_exists('comment')) {
- $definitions['comment'] = array(
- 'title' => t('Comments'),
- 'description' => t('Comments are responses to node content.'),
- 'handler' => 'flag_comment',
- );
- }
+ return $definitions;
+}
+
+/**
+ * Implement hook_flag_type_info() on behalf of the core Comment module.
+ */
+function comment_flag_type_info() {
+ $definitions['comment'] = array(
+ 'title' => t('Comments'),
+ 'description' => t('Comments are responses to node content.'),
+ 'handler' => 'flag_comment',
+ );
+
+ return $definitions;
+}
+
+/**
+ * Implement hook_flag_type_info() on behalf of the core Taxonomy module.
+ */
+function taxonomy_flag_type_info() {
+ $definitions['taxonomy_term'] = array(
+ 'title' => t('Taxonomy Terms'),
+ 'description' => t('Taxonomy terms are used to categorize content.'),
+ 'handler' => 'flag_entity',
+ );
return $definitions;
}