You are here

function mollie_payment_method_configuration in Mollie Payment 7

Same name and namespace in other branches
  1. 7.2 mollie_payment.module \mollie_payment_method_configuration()

Payment method configuration form elements callback.

Parameters

array $form: A Drupal form array.

array $form_state: The current state of the form.

Return value

array A Drupal form array.

File

./mollie_payment.module, line 470
Provides Mollie integration for the Payment platform.

Code

function mollie_payment_method_configuration(array $form, array &$form_state) {
  $controller_data = $form_state['payment_method']->controller_data;
  if (!is_array($form)) {
    $form = array();
  }

  /* @todo Use test and live ids, let user select test or live mode */
  $form['mollie_api_key'] = array(
    '#type' => 'textfield',
    '#required' => TRUE,
    '#title' => t('Mollie API key'),
    '#description' => t('Your Mollie API key'),
    '#default_value' => isset($controller_data['mollie_api_key']) ? $controller_data['mollie_api_key'] : '',
  );
  $form['mollie_test_api_key'] = array(
    '#type' => 'textfield',
    '#title' => t('Mollie test API key'),
    '#description' => t('Your Mollie test API key'),
    '#default_value' => isset($controller_data['mollie_test_api_key']) ? $controller_data['mollie_test_api_key'] : '',
  );
  $form['webhook_base_url'] = array(
    '#type' => 'textfield',
    '#title' => t('Webhook Base URL'),
    '#description' => t('When testing in a local environment you may want to use a service like ngrok to
    make your environment accessible from the outside. Leave empty for online environments. Please note
    that Mollie checks the webhook URL\'s for a valid TLD. Mollie Payment does not work with a
    local test domain like my-project.dev.'),
    '#default_value' => isset($controller_data['webhook_base_url']) ? $controller_data['webhook_base_url'] : '',
  );
  $form['advanced'] = array(
    '#type' => 'checkbox',
    '#title' => t('Advanced'),
    '#description' => t('In advanced mode the payer can select the payment method in Drupal.'),
    '#default_value' => isset($controller_data['advanced']) ? $controller_data['advanced'] : 0,
  );
  $form['test_mode'] = array(
    '#type' => 'checkbox',
    '#title' => t('Test mode'),
    '#description' => t('In test mode the test API key is used and no real money is transfered.'),
    '#default_value' => isset($controller_data['test_mode']) ? $controller_data['test_mode'] : 0,
  );
  return $form;
}