You are here

function commerce_reorder_handler_field_commerce_reorder_button::options_form in Commerce Reorder 7

Same name and namespace in other branches
  1. 7.2 includes/views/handlers/commerce_reorder_handler_field_commerce_reorder_button.inc \commerce_reorder_handler_field_commerce_reorder_button::options_form()

Default options form provides the label widget that all fields should have.

Overrides views_handler_field::options_form

File

includes/views/handlers/commerce_reorder_handler_field_commerce_reorder_button.inc, line 20

Class

commerce_reorder_handler_field_commerce_reorder_button

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);
  $form['reorder_button_label'] = array(
    '#type' => 'textfield',
    '#title' => t('Reorder button label'),
    '#default_value' => $this->options['reorder_button_label'],
  );
  $form['redirect'] = array(
    '#type' => 'checkbox',
    '#title' => t('Redirect after reorder'),
    '#default_value' => $this->options['redirect'],
  );
  $form['redirect_url'] = array(
    '#type' => 'textfield',
    '#title' => t('Target URL to redirect after reorder'),
    '#default_value' => $this->options['redirect_url'],
    '#description' => t('Tokens are supported. For instance you may use <strong></strong><code>checkout/[site:current-cart-order:order-id]/review</code></strong> to go directly to the review step.'),
    '#dependency' => array(
      'edit-options-redirect' => array(
        TRUE,
      ),
    ),
  );
  $types = commerce_customer_profile_types();
  $copy_profile_options = array();
  foreach ($types as $type => $type_data) {
    $copy_profile_options[$type] = t($type_data['name']);
  }
  $form['copy_profiles'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Copy customer profiles to the new order'),
    '#description' => t('The selected profiles, if present on the existing order, will be copied to the new order.'),
    '#options' => $copy_profile_options,
    '#default_value' => $this->options['copy_profiles'],
  );
}