From a2f13e9a35365ae9432960982442f95dbe5fb1bc Mon Sep 17 00:00:00 2001 From: Alex Barth <alex_b@53995.no-reply.drupal.org> Date: Thu, 18 Feb 2010 17:32:49 +0000 Subject: [PATCH] Roll back 'Make configDefaults() implementation optional.' - leads to infinite loops in some cases. --- includes/FeedsConfigurable.inc | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/includes/FeedsConfigurable.inc b/includes/FeedsConfigurable.inc index f2400126..6380aae5 100644 --- a/includes/FeedsConfigurable.inc +++ b/includes/FeedsConfigurable.inc @@ -89,7 +89,7 @@ abstract class FeedsConfigurable { * returned by configDefaults(). */ public function setConfig($config) { - $default_keys = $this->configDefaultsMerged(); + $default_keys = $this->configDefaults(); $this->config = array_intersect_key($config, $default_keys); } @@ -102,7 +102,7 @@ abstract class FeedsConfigurable { */ public function addConfig($config) { $this->config = array_merge($this->config, $config); - $default_keys = $this->configDefaultsMerged(); + $default_keys = $this->configDefaults(); $this->config = array_intersect_key($this->config, $default_keys); } @@ -137,32 +137,6 @@ abstract class FeedsConfigurable { return array(); } - /** - * Return config defaults merged with the actual form definition. This is - * used for filtering values in setConfig and addConfig and allows - * implementers of configForm() to add form elements without necessarily - * declaring them in configDefaults(). - * - * @todo Support nested form trees. - */ - protected function configDefaultsMerged() { - $form_state = array(); - $form = $this->configForm($form_state); - // Mimic Form API behavior. - drupal_prepare_form('form_'. get_class($this) .'_feeds_config_form', $form, $form_state); - drupal_alter('form_'. get_class($this) .'_feeds_config_form', $form, $form_state); - drupal_alter('form', $form, $form_state, get_class($this) .'_feeds_config_form'); - unset($form['form_token']); - unset($form['form_id']); - $defaults = array(); - foreach (element_children($form) as $e) { - if (isset($form[$e]['#default_value'])) { - $defaults[$e] = $form[$e]['#default_value']; - } - } - return $this->configDefaults() + $defaults; - } - /** * Return configuration form for this object. The keys of the configuration * form must match the keys of the array returned by configDefaults(). -- GitLab