You are here

function managed_file_element_info_alter in Managed File 7

Implements hook_element_info_alter().

File

./managed_file.module, line 29

Code

function managed_file_element_info_alter(array &$types) {
  $types['managed_file'] += [
    // Could be "imce" or "ckfinder".
    '#widget' => FALSE,
    '#preview' => TRUE,
    // WARNING! If this will be set to TRUE, then on form submit will be an
    // array of values instead of file ID.
    '#styles' => FALSE,
  ];

  // Store default callback to custom property.
  $types['managed_file']['#default_value_callback'] = $types['managed_file']['#value_callback'];

  // Override default callback for obtaining the value.
  $types['managed_file']['#value_callback'] = 'managed_file_element_value';

  // Must be executed by the first due to low-level processing.
  array_unshift($types['managed_file']['#process'], 'managed_file_element_process');
}