You are here

function filefield_sources_field_value in FileField Sources 8

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

A #filefield_value_callback to run source value callbacks.

1 string reference to 'filefield_sources_field_value'
filefield_sources_element_info_alter in ./filefield_sources.module
Implements hook_element_info_alter().

File

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

Code

function filefield_sources_field_value(&$element, &$input, FormStateInterface $form_state) {

  // Do all processing as needed by each source.
  $sources = filefield_sources_info();
  foreach ($sources as $source) {
    if (isset($source['class'])) {
      $callback = [
        $source['class'],
        'value',
      ];
      if (is_callable($callback)) {
        call_user_func_array($callback, [
          &$element,
          &$input,
          $form_state,
        ]);
      }
    }
  }
}