summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Davis2013-01-29 22:44:21 (GMT)
committer Ben Davis2013-01-29 22:44:21 (GMT)
commit3759cbd3c431f23c29e8f586e59b3436b06dba25 (patch)
treeedab9776aedc56dbf3b0ddd87b38aace9280152e
parent0824017f938bccf16067d3917ef7fafceb4319ad (diff)
Issue #1901386 by tripper54: Feeds support.
-rw-r--r--weight.module35
1 files changed, 35 insertions, 0 deletions
diff --git a/weight.module b/weight.module
index 076d7ab..ddbe195 100644
--- a/weight.module
+++ b/weight.module
@@ -375,6 +375,41 @@ function weight_menu_link_update($link) {
}
/**
+ * Implements hook_feeds_processor_targets_alter()
+ */
+function weight_feeds_processor_targets_alter(&$targets, $entity_type, $bundle_name) {
+ if ($entity_type == 'node') {
+ $settings = _weight_get_settings($bundle_name);
+ if (!empty($settings) && ($settings['enabled'])) {
+ $targets['weight'] = array(
+ 'name' => t('Weight'),
+ 'callback' => 'weight_feeds_set_target',
+ 'description' => t('The weight of the node.'),
+ );
+ }
+ }
+}
+
+/**
+ * Callback for mapping weights.
+ *
+ * @param $source
+ * Field mapper source settings.
+ * @param $entity
+ * An entity object, for instance a node object.
+ * @param $target
+ * A string identifying the target on the node.
+ * @param $value
+ * The value to populate the target with.
+ * @param $mapping
+ * Associative array of the mapping settings from the per mapping
+ * configuration form.
+ */
+function weight_feeds_set_target($source, $entity, $target, $value) {
+ $entity->weight_weight = $value;
+}
+
+/**
* Implements hook_features_api().
*/
function weight_features_api() {