You are here

function filefield_sources_info in FileField Sources 8

Same name and namespace in other branches
  1. 6 filefield_sources.module \filefield_sources_info()
  2. 7 filefield_sources.module \filefield_sources_info()

Load hook_filefield_sources_info() data from all modules.

5 calls to filefield_sources_info()
filefield_sources_field_process in ./filefield_sources.module
A #process callback to extend the filefield_widget element type.
filefield_sources_field_validate in ./filefield_sources.module
An #element_validate function to run source validations.
filefield_sources_field_value in ./filefield_sources.module
A #filefield_value_callback to run source value callbacks.
filefield_sources_list in ./filefield_sources.module
Create a list of FileField Sources by name, suitable for a select list.
template_preprocess_filefield_sources_element in ./filefield_sources.module
Theme the display of the source element.

File

./filefield_sources.module, line 397
Extend FileField to allow files from multiple sources.

Code

function filefield_sources_info($include_default = TRUE) {
  $info = \Drupal::service('filefield_sources')
    ->getDefinitions();
  if (isset($info['imce']) && !Imce::access()) {
    unset($info['imce']);
  }
  if ($include_default) {
    $info['upload'] = [
      'name' => t('Upload (default)'),
      'label' => t('Upload'),
      'description' => t('Upload a file from your computer.'),
      'weight' => -10,
    ];
  }
  uasort($info, '_filefield_sources_sort');
  return $info;
}