You are here

function commerce_discount_date_combo_process_alter in Commerce Discount 7

Implements hook_date_combo_process_alter().

File

includes/commerce_discount.admin.inc, line 457
Commerce discount editing UI.

Code

function commerce_discount_date_combo_process_alter(&$element, &$form_state, $context) {
  if ($element['#field_name'] == 'commerce_discount_date') {
    $element['#attributes'] = 'container-inline';

    // Hide the checkbox for showing the end date.
    $element['show_todate']['#type'] = 'value';
    $element['show_todate']['#default_value'] = TRUE;
    unset($element['show_todate']['#prefix']);
    unset($element['show_todate']['#suffix']);

    // Ignore the "Show end date" checkbox.
    unset($element['value2']['#states']);

    // Remove fieldset description.
    $element['#fieldset_description'] = '';
  }
}