Skip to main content
Added Drupal code
Source Link

You can adapt this methodology to work with Drupal too. You'd have to create a module with an appropriately-named function, but the code inside the function should be identical. Here's the code to add to a Drupal module:

/**
 * Amend the button value.
 *
 * @param string $formName The name of the form.
 * @param CRM_Core_Form $form The form object.
 */
function my_module_prefix_civicrm_buildForm( $formName, &$form ) {

    // bail if not the form we want
    if ( $formName != 'CRM_Event_Form_Registration_Confirm' ) return;

    // drill down until we find the submit element and change its value
    foreach( $form->_elements as $element ) {
        if ( isset( $element->_name ) && $element->_name == 'buttons' ) {
            foreach( $element->_elements as $item ) {
                if ( isset( $item->_type ) && $item->_type == 'submit' ) {
                    if ( isset( $item->_attributes ) && $item->_attributes['name'] == '_qf_Confirm_next' ) {
                        $item->_attributes['value'] = t( 'Continue to pay via Paypal' );
                    }
                }
            }
        }
    }

}

You need to substitute my_module_prefix with the actual prefix of your module so that the function receives callbacks from the hook.

You can adapt this methodology to work with Drupal too. You'd have to create a module with an appropriately-named function, but the code inside the function should be identical.

You can adapt this methodology to work with Drupal too. You'd have to create a module with an appropriately-named function, but the code inside the function should be identical. Here's the code to add to a Drupal module:

/**
 * Amend the button value.
 *
 * @param string $formName The name of the form.
 * @param CRM_Core_Form $form The form object.
 */
function my_module_prefix_civicrm_buildForm( $formName, &$form ) {

    // bail if not the form we want
    if ( $formName != 'CRM_Event_Form_Registration_Confirm' ) return;

    // drill down until we find the submit element and change its value
    foreach( $form->_elements as $element ) {
        if ( isset( $element->_name ) && $element->_name == 'buttons' ) {
            foreach( $element->_elements as $item ) {
                if ( isset( $item->_type ) && $item->_type == 'submit' ) {
                    if ( isset( $item->_attributes ) && $item->_attributes['name'] == '_qf_Confirm_next' ) {
                        $item->_attributes['value'] = t( 'Continue to pay via Paypal' );
                    }
                }
            }
        }
    }

}

You need to substitute my_module_prefix with the actual prefix of your module so that the function receives callbacks from the hook.

Bounty Ended with 50 reputation awarded by Jenni Simonis
Source Link

If you're using WordPress, you can write a quick plugin to do this. The following code amends the submit button's text value on the Registration Confirmation form:

add_action( 'civicrm_buildForm', 'my_prefix_alter_form_button', 10, 2 );

/**
 * Amend the Registration Confirmation form submit button value.
 *
 * @param string $formName The name of the form.
 * @param CRM_Core_Form $form The form object.
 */
function my_prefix_alter_form_button( $formName, &$form ) {

    // bail if not the form we want
    if ( $formName != 'CRM_Event_Form_Registration_Confirm' ) return;

    // drill down until we find the submit element and change its value
    foreach( $form->_elements as $element ) {
        if ( isset( $element->_name ) && $element->_name == 'buttons' ) {
            foreach( $element->_elements as $item ) {
                if ( isset( $item->_type ) && $item->_type == 'submit' ) {
                    if ( isset( $item->_attributes ) && $item->_attributes['name'] == '_qf_Confirm_next' ) {
                        $item->_attributes['value'] = __( 'Continue to pay via Paypal', 'my-plugin-slug' );
                    }
                }
            }
        }
    }

}

You can adapt this methodology to work with Drupal too. You'd have to create a module with an appropriately-named function, but the code inside the function should be identical.