You are here

function commerce_file_element_info in Commerce File 7

Implements hook_element_info().

File

includes/commerce_file.elements.inc, line 14
Commerce File form elements

Code

function commerce_file_element_info() {
  $types = array();

  // A limit integer textfield
  $types['commerce_file_limit_integer'] = array(
    '#input' => TRUE,
    '#tree' => TRUE,
    '#pre_render' => array(
      'form_pre_render_conditional_form_element',
    ),
    '#value_callback' => 'commerce_file_limit_integer_element_value',
    '#process' => array(
      'commerce_file_limit_integer_element_process',
    ),
    '#element_validate' => array(
      'commerce_file_limit_integer_element_validate',
    ),
    '#limit_inherited_value' => NULL,
    '#default_value' => array(
      'mode' => COMMERCE_FILE_LIMIT_UNLIMITED,
      'value' => '',
    ),
  );

  // A limit duration form element which represents the duration in seconds.
  $types['commerce_file_limit_duration'] = array(
    '#input' => TRUE,
    '#tree' => TRUE,
    '#pre_render' => array(
      'form_pre_render_conditional_form_element',
    ),
    '#value_callback' => 'commerce_file_limit_duration_element_value',
    '#process' => array(
      'commerce_file_limit_duration_element_process',
    ),
    '#element_validate' => array(
      'commerce_file_limit_duration_element_validate',
    ),
    '#limit_inherited_value' => NULL,
    '#default_value' => array(
      'mode' => COMMERCE_FILE_LIMIT_UNLIMITED,
      'value' => '',
    ),
  );
  return $types;
}