diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-09-18 00:12:48 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-09-18 00:12:48 +0000 |
commit | df02fa3ca46e16974192de77580762188ad47f49 (patch) | |
tree | 91b2354aae786d7b187028dbc61fb3893b04ae64 /modules/aggregator | |
parent | e18feedfdb429e35173b85fc7182aadabee0a166 (diff) | |
download | brdo-df02fa3ca46e16974192de77580762188ad47f49.tar.gz brdo-df02fa3ca46e16974192de77580762188ad47f49.tar.bz2 |
#571086 by sun and merlinofchaos: Added a 'wrapper callback' that executes
before a form builder function, to facilitate common form elements. Clean-up
from form_builder changes from CTools patch. Has nice side-benefit of making
all form functions' signatures consistent.
Diffstat (limited to 'modules/aggregator')
-rw-r--r-- | modules/aggregator/aggregator.admin.inc | 10 | ||||
-rw-r--r-- | modules/aggregator/aggregator.test | 20 |
2 files changed, 15 insertions, 15 deletions
diff --git a/modules/aggregator/aggregator.admin.inc b/modules/aggregator/aggregator.admin.inc index 05efbe151..b1fc85a8d 100644 --- a/modules/aggregator/aggregator.admin.inc +++ b/modules/aggregator/aggregator.admin.inc @@ -58,7 +58,7 @@ function aggregator_view() { * @see aggregator_form_feed_validate() * @see aggregator_form_feed_submit() */ -function aggregator_form_feed(&$form_state, stdClass $feed = NULL) { +function aggregator_form_feed($form, &$form_state, stdClass $feed = NULL) { $period = drupal_map_assoc(array(900, 1800, 3600, 7200, 10800, 21600, 32400, 43200, 64800, 86400, 172800, 259200, 604800, 1209600, 2419200), 'format_interval'); $period[AGGREGATOR_CLEAR_NEVER] = t('Never'); @@ -196,7 +196,7 @@ function aggregator_form_feed_submit($form, &$form_state) { } } -function aggregator_admin_remove_feed($form_state, $feed) { +function aggregator_admin_remove_feed($form, $form_state, $feed) { return confirm_form( array( 'feed' => array( @@ -230,7 +230,7 @@ function aggregator_admin_remove_feed_submit($form, &$form_state) { * @see aggregator_form_opml_validate() * @see aggregator_form_opml_submit() */ -function aggregator_form_opml(&$form_state) { +function aggregator_form_opml($form, &$form_state) { $period = drupal_map_assoc(array(900, 1800, 3600, 7200, 10800, 21600, 32400, 43200, 64800, 86400, 172800, 259200, 604800, 1209600, 2419200), 'format_interval'); $form['upload'] = array( @@ -390,7 +390,7 @@ function aggregator_admin_refresh_feed($feed) { * * @ingroup forms */ -function aggregator_admin_form($form_state) { +function aggregator_admin_form($form, $form_state) { // Make sure configuration is sane. aggregator_sanitize_configuration(); @@ -496,7 +496,7 @@ function aggregator_admin_form_submit($form, &$form_state) { * @see aggregator_form_category_validate() * @see aggregator_form_category_submit() */ -function aggregator_form_category(&$form_state, $edit = array('title' => '', 'description' => '', 'cid' => NULL)) { +function aggregator_form_category($form, &$form_state, $edit = array('title' => '', 'description' => '', 'cid' => NULL)) { $form['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#default_value' => $edit['title'], diff --git a/modules/aggregator/aggregator.test b/modules/aggregator/aggregator.test index b8ea4120f..16d5e64ca 100644 --- a/modules/aggregator/aggregator.test +++ b/modules/aggregator/aggregator.test @@ -551,20 +551,20 @@ class ImportOPMLTestCase extends AggregatorTestCase { function validateImportFormFields() { $before = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchField(); - $form = array(); - $this->drupalPost('admin/config/services/aggregator/add/opml', $form, t('Import')); + $edit = array(); + $this->drupalPost('admin/config/services/aggregator/add/opml', $edit, t('Import')); $this->assertRaw(t('You must <em>either</em> upload a file or enter a URL.'), t('Error if no fields are filled.')); $path = $this->getEmptyOpml(); - $form = array( + $edit = array( 'files[upload]' => $path, 'remote' => file_create_url($path), ); - $this->drupalPost('admin/config/services/aggregator/add/opml', $form, t('Import')); + $this->drupalPost('admin/config/services/aggregator/add/opml', $edit, t('Import')); $this->assertRaw(t('You must <em>either</em> upload a file or enter a URL.'), t('Error if both fields are filled.')); - $form = array('remote' => 'invalidUrl://empty'); - $this->drupalPost('admin/config/services/aggregator/add/opml', $form, t('Import')); + $edit = array('remote' => 'invalidUrl://empty'); + $this->drupalPost('admin/config/services/aggregator/add/opml', $edit, t('Import')); $this->assertText(t('This URL is not valid.'), t('Error if the URL is invalid.')); $after = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchField(); @@ -581,8 +581,8 @@ class ImportOPMLTestCase extends AggregatorTestCase { $this->drupalPost('admin/config/services/aggregator/add/opml', $form, t('Import')); $this->assertText(t('No new feed has been added.'), t('Attempting to upload invalid XML.')); - $form = array('remote' => file_create_url($this->getEmptyOpml())); - $this->drupalPost('admin/config/services/aggregator/add/opml', $form, t('Import')); + $edit = array('remote' => file_create_url($this->getEmptyOpml())); + $this->drupalPost('admin/config/services/aggregator/add/opml', $edit, t('Import')); $this->assertText(t('No new feed has been added.'), t('Attempting to load empty OPML from remote URL.')); $after = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchField(); @@ -604,12 +604,12 @@ class ImportOPMLTestCase extends AggregatorTestCase { $feeds[0] = $this->getFeedEditArray(); $feeds[1] = $this->getFeedEditArray(); $feeds[2] = $this->getFeedEditArray(); - $form = array( + $edit = array( 'files[upload]' => $this->getValidOpml($feeds), 'refresh' => '900', 'category[1]' => $category, ); - $this->drupalPost('admin/config/services/aggregator/add/opml', $form, t('Import')); + $this->drupalPost('admin/config/services/aggregator/add/opml', $edit, t('Import')); $this->assertRaw(t('A feed with the URL %url already exists.', array('%url' => $feeds[0]['url'])), t('Verifying that a duplicate URL was identified')); $this->assertRaw(t('A feed named %title already exists.', array('%title' => $feeds[1]['title'])), t('Verifying that a duplicate title was identified')); |