summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralexweber2013-02-08 20:09:13 (GMT)
committer Joachim Noreiko2013-02-08 20:09:13 (GMT)
commit2c308c0311ed428109361385235a1f43a966dd5e (patch)
tree0b0326cf2b27ee2e89d7d02fc2c602f87f1dbde8
parentb2e1289fec2b0ad88429acad081c22b9aae23ca9 (diff)
Issue #1905750 by alexweber: Added module property to hook_flag_type_info(), and explicitly defined taxonomy term flag type, so that non-required core modules correctly declare dependencies.
-rw-r--r--flag.api.php3
-rw-r--r--flag.flag.inc10
-rw-r--r--includes/flag.features.inc2
3 files changed, 14 insertions, 1 deletions
diff --git a/flag.api.php b/flag.api.php
index 64b205f..9feb8f8 100644
--- a/flag.api.php
+++ b/flag.api.php
@@ -25,6 +25,8 @@
* - 'description': A longer description shown in the UI when creating a new
* flag.
* - 'handler': The name of the class implementing this flag type.
+ * - 'module': (optional) The name of the module that should be registered as a
+ * dependency for this flag type.
*
* @see flag_fetch_definition()
*/
@@ -34,6 +36,7 @@ function hook_flag_type_info() {
'title' => t('Nodes'),
'description' => t("Nodes are a Drupal site's primary content."),
'handler' => 'flag_node',
+ 'module' => 'node',
),
);
}
diff --git a/flag.flag.inc b/flag.flag.inc
index 254b593..c7ff2ec 100644
--- a/flag.flag.inc
+++ b/flag.flag.inc
@@ -34,6 +34,16 @@ function flag_flag_type_info() {
'title' => t('Comments'),
'description' => t('Comments are responses to node content.'),
'handler' => 'flag_comment',
+ 'module' => 'comment',
+ );
+ }
+
+ if (module_exists('taxonomy')) {
+ $definitions['taxonomy_term'] = array(
+ 'title' => t('Taxonomy Terms'),
+ 'description' => t('Taxonomy terms are used to categorize content.'),
+ 'handler' => 'flag_entity',
+ 'module' => 'taxonomy',
);
}
diff --git a/includes/flag.features.inc b/includes/flag.features.inc
index 23ad242..a3a1064 100644
--- a/includes/flag.features.inc
+++ b/includes/flag.features.inc
@@ -85,7 +85,7 @@ function flag_features_providing_module() {
$hook = 'flag_type_info';
foreach (module_implements($hook) as $module) {
foreach (module_invoke($module, $hook) as $key => $value) {
- $modules[$key] = $module;
+ $modules[$key] = isset($value['module']) ? $value['module'] : $module;
}
}
return $modules;