From 8658a4eeb29fc3db584afbc328ce740b406341f3 Mon Sep 17 00:00:00 2001 From: Chris Leppanen <chris.leppanen@gmail.com> Date: Wed, 26 Sep 2012 01:01:01 -0700 Subject: [PATCH] Remove stupid feeds_alter(). --- feeds.module | 24 ------------------------ plugins/FeedsNodeProcessor.inc | 4 +++- plugins/FeedsParser.inc | 3 ++- plugins/FeedsTermProcessor.inc | 4 +++- plugins/FeedsUserProcessor.inc | 4 +++- 5 files changed, 11 insertions(+), 28 deletions(-) diff --git a/feeds.module b/feeds.module index 2084b783..7f483b40 100644 --- a/feeds.module +++ b/feeds.module @@ -1044,30 +1044,6 @@ function feeds_include_simplepie() { return FALSE; } -/** - * Simplified drupal_alter(). - * - * - None of that 'multiple parameters by ref' crazyness. - * - Don't use module_implements() to allow hot including on behalf - * implementations (see mappers/). - * - * @todo This needs to be removed and drupal_alter() used. This is crazy dumb. - */ -function feeds_alter($type, &$data) { - $args = array(&$data); - $additional_args = func_get_args(); - array_shift($additional_args); - array_shift($additional_args); - $args = array_merge($args, $additional_args); - - $hook = $type . '_alter'; - foreach (module_list() as $module) { - if (module_hook($module, $hook)) { - call_user_func_array($module . '_' . $hook, $args); - } - } -} - /** * @} */ diff --git a/plugins/FeedsNodeProcessor.inc b/plugins/FeedsNodeProcessor.inc index 11844c12..b80953b1 100644 --- a/plugins/FeedsNodeProcessor.inc +++ b/plugins/FeedsNodeProcessor.inc @@ -310,7 +310,9 @@ class FeedsNodeProcessor extends FeedsProcessor { // Let other modules expose mapping targets. self::loadMappers(); - feeds_alter('feeds_processor_targets', $targets, 'node', $this->config['content_type']); + $entity_type = $this->entityType(); + $bundle = $this->config['content_type']; + drupal_alter('feeds_processor_targets', $targets, $entity_type, $bundle); return $targets; } diff --git a/plugins/FeedsParser.inc b/plugins/FeedsParser.inc index 5cdac88f..209802b7 100644 --- a/plugins/FeedsParser.inc +++ b/plugins/FeedsParser.inc @@ -96,7 +96,8 @@ abstract class FeedsParser extends FeedsPlugin { public function getMappingSources() { self::loadMappers(); $sources = array(); - feeds_alter('feeds_parser_sources', $sources, feeds_importer($this->id)->config['content_type']); + $content_type = feeds_importer($this->id)->config['content_type']; + drupal_alter('feeds_parser_sources', $sources, $content_type); if (!feeds_importer($this->id)->config['content_type']) { return $sources; } diff --git a/plugins/FeedsTermProcessor.inc b/plugins/FeedsTermProcessor.inc index 85a93118..7721ff01 100644 --- a/plugins/FeedsTermProcessor.inc +++ b/plugins/FeedsTermProcessor.inc @@ -201,7 +201,9 @@ class FeedsTermProcessor extends FeedsProcessor { // Let implementers of hook_feeds_term_processor_targets() add their targets. try { self::loadMappers(); - feeds_alter('feeds_processor_targets', $targets, 'taxonomy_term', $this->vocabulary()->machine_name); + $entity_type = $this->entityType(); + $bundle = $this->vocabulary()->machine_name; + drupal_alter('feeds_processor_targets', $targets, $entity_type, $bundle); } catch (Exception $e) { // Do nothing. diff --git a/plugins/FeedsUserProcessor.inc b/plugins/FeedsUserProcessor.inc index c8a1fa4c..49e3acd0 100644 --- a/plugins/FeedsUserProcessor.inc +++ b/plugins/FeedsUserProcessor.inc @@ -192,7 +192,9 @@ class FeedsUserProcessor extends FeedsProcessor { // Let other modules expose mapping targets. self::loadMappers(); - feeds_alter('feeds_processor_targets', $targets, 'user', 'user'); + $entity_type = $this->entityType(); + $bundle = $this->entityType(); + drupal_alter('feeds_processor_targets', $targets, $entity_type, $bundle); return $targets; } -- GitLab