You are here

function commerce_license_renew_action_form in Commerce License 7

Configuration form for commerce_license_renew_action.

File

./commerce_license.module, line 1281
Provides a framework for selling access to local or remote resources.

Code

function commerce_license_renew_action_form($context) {
  $default_value = 5;
  $default_unit = 86400;
  $description = t('Note: Months are 30 days long');
  $form = array(
    '#attached' => array(
      'css' => array(
        drupal_get_path('module', 'commerce_license') . '/theme/commerce-license.css',
      ),
    ),
    '#attributes' => array(
      'class' => array(
        'commerce-license-duration-wrapper',
      ),
    ),
  );
  $form['duration'] = array(
    '#type' => 'container',
    'duration_value' => array(
      '#type' => 'textfield',
      '#title' => t('Renew the license for another:'),
      '#size' => 5,
      '#default_value' => $default_value,
      '#element_validate' => array(
        'element_validate_integer_positive',
      ),
    ),
    'duration_unit' => array(
      '#type' => 'select',
      '#default_value' => $default_unit,
      '#options' => commerce_license_duration_units(),
    ),
    'description' => array(
      '#markup' => '<div class="description">' . $description . '</div>',
    ),
    '#attributes' => array(
      'class' => array(
        'commerce-license-duration container-inline',
      ),
    ),
  );
  return $form;
}