r79971 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79970‎ | r79971 | r79972 >
Date:23:13, 10 January 2011
Author:awjrichards
Status:deferred
Tags:
Comment:
Modified how recurring payments configuration works - now using hook_menu_alter to inject recurring configuration to queue2civicrm config menu, put recurring configuration into its own form (no longer using hook_form_alter to inject recurring configuration directly into queue2civicrm config form)
Modified paths:
  • /civicrm/trunk/sites/all/modules/queue2civicrm/recurring/recurring.module (modified) (history)

Diff [purge]

Index: civicrm/trunk/sites/all/modules/queue2civicrm/recurring/recurring.module
@@ -17,22 +17,33 @@
1818 require_once( drupal_get_path( 'module', 'queue2civicrm' ) . '/queue2civicrm_common.inc' );
1919
2020 /**
21 - * Implementation of hook_form_alter
 21+ * Implementation of hook_menu_alter
2222 *
23 - * To expand the configuration form for queue2civicrm_settings to include
24 - * settings for recurring donations.
 23+ * Used to inject recurring menu item to Queue2civicrm configuration
2524 */
26 -function recurring_form_alter( &$form, &$form_state, $form_id ) {
27 -
28 - // make sure we're altering the correct form
29 - if ( $form_id != 'queue2civicrm_settings' ) {
30 - return;
31 - }
32 -
33 - $form[ 'recurring' ] = array(
 25+function recurring_menu_alter( &$items ) {
 26+ $items['admin/settings/queue2civicrm/recurring'] = array(
 27+ 'title' => 'Recurring payments',
 28+ 'description' => t( 'Configure recurring payments-related settings' ),
 29+ 'access arguments' => array( 'administer queue2civicrm' ),
 30+ 'page callback' => 'drupal_get_form',
 31+ 'page arguments' => array( 'recurring_settings' ),
 32+ 'type' => MENU_LOCAL_TASK
 33+ );
 34+ return $items;
 35+}
 36+
 37+/**
 38+ * Settings form for recurring payments configuration
 39+ */
 40+function recurring_settings() {
 41+ $form = array();
 42+
 43+ $form[ 'recurring' ][ 'description' ] = array(
3444 '#type' => 'fieldset',
3545 '#title' => t( 'Recurring payments' ),
36 - '#collapsible' => TRUE,
 46+ '#description' => t( 'Use the form below to configure settings pertinent to recurring contributions.' ),
 47+ '#collapsible' => FALSE,
3748 '#collapsed' => FALSE,
3849 );
3950
@@ -65,7 +76,7 @@
6677 ),
6778 );
6879
69 - return $form;
 80+ return system_settings_form( $form );
7081 }
7182
7283 /**
@@ -633,4 +644,4 @@
634645 $msg_normalized[ 'date' ] = $timestamp;
635646
636647 return $msg_normalized;
637 -}
\ No newline at end of file
 648+}

Status & tagging log