0

I have a site running with Drupal 7.12 and Ubercart 3.0. I am creating a custom payment module which is used to pay by mobile phone. The workflow is:

  1. User enters his mobile phone number in the checkout page
  2. When he clicks on "verify phone number" he gets an SMS with a PIN which he has to enter in another input field.

The PIN field is a required field, but only if this specific payment option is chosen.

I know that i can add additional information by returning an instructions array in my callback method, like this:

function uc_my_payment_method($op, &$order) {
    switch ($op) {
        case 'cart-details':
            $build['instructions'] = array(
                '#markup' => t('Your mobile phone') . ': ' .
                     /* some markup for the new input fields */
                    '<br />'
            );
            return $build;
    }
}

But i am stuck at the form elements. Can you help me? Do you need additional information?

1 Answer 1

3

It's a bit late but just for reference for anyone finding this page as a search result: From what I found out by experimenting, you are right that you need to return an element. Actually what I had to do in my case was to use the following code:

$form = array();
$form['mobile_phone'] = array(
  '#type' => 'textfield',
  '#title' => t('Mobile phone'),
  '#description' => t('Enter your mobile phone number here and a PIN will get sent to you.'),
);
return $form;

You just build a normal form and it gets drupal_rendered when needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.