You are here

function commerce_mollie_settings_form in Commerce Mollie 7

Implements hook_commerce_settings_form().

File

./commerce_mollie.module, line 110

Code

function commerce_mollie_settings_form($settings = NULL) {
  $form = array();

  // Merge default settings into the stored settings array.
  $settings = (array) $settings + array(
    'commerce_mollie_api_key_live' => '',
    'commerce_mollie_api_key_test' => '',
    'commerce_mollie_test_mode' => 0,
    'commerce_mollie_redirect_page_button_text' => 'Pay via Mollie',
    'commerce_mollie_redirect_page_text' => 'Continue with checkout to complete payment via Mollie.',
  );
  $form['commerce_mollie_api_key_live'] = array(
    '#type' => 'textfield',
    '#title' => t('Mollie live API key'),
    '#description' => t('Your Mollie live API key.'),
    '#default_value' => $settings['commerce_mollie_api_key_live'],
    '#required' => TRUE,
    '#element_validate' => array(
      '_commerce_mollie_api_key_element_validate',
    ),
  );
  $form['commerce_mollie_api_key_test'] = array(
    '#type' => 'textfield',
    '#title' => t('Mollie test API key'),
    '#description' => t('Your Mollie test API key.'),
    '#default_value' => $settings['commerce_mollie_api_key_test'],
    '#required' => TRUE,
    '#element_validate' => array(
      '_commerce_mollie_api_key_element_validate',
    ),
  );
  $form['commerce_mollie_test_mode'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable test mode'),
    '#description' => t('Check this option to enable test mode.'),
    '#default_value' => $settings['commerce_mollie_test_mode'],
  );
  $form['commerce_mollie_redirect_page_button_text'] = array(
    '#type' => 'textfield',
    '#title' => t('Payment button text'),
    '#description' => t('The text of the payment button that redirects the user to the Mollie website.'),
    '#default_value' => $settings['commerce_mollie_redirect_page_button_text'],
    '#required' => TRUE,
  );
  $form['commerce_mollie_redirect_page_text'] = array(
    '#type' => 'textarea',
    '#title' => t('Payment page text'),
    '#description' => t('The text displayed above the payment button that redirects the user to the Mollie website.'),
    '#default_value' => $settings['commerce_mollie_redirect_page_text'],
    '#required' => FALSE,
  );
  return $form;
}