function filefield_sources_invoke_all in FileField Sources 8
Same name and namespace in other branches
- 6 filefield_sources.module \filefield_sources_invoke_all()
- 7 filefield_sources.module \filefield_sources_invoke_all()
Call all FileField Source hooks stored in the available include files.
1 call to filefield_sources_invoke_all()
- filefield_sources_form in ./
filefield_sources.module - Configuration form for editing FileField Sources settings for a widget.
File
- ./
filefield_sources.module, line 373 - Extend FileField to allow files from multiple sources.
Code
function filefield_sources_invoke_all($method, &$params) {
$return = [];
foreach (\Drupal::service('filefield_sources')
->getDefinitions() as $definition) {
if (!isset($definition['class'])) {
continue;
}
// Get routes defined by each plugin.
$callback = [
$definition['class'],
$method,
];
if (is_callable($callback)) {
$result = call_user_func_array($callback, $params);
if (isset($result) && is_array($result)) {
$return = array_merge_recursive($return, $result);
}
elseif (isset($result)) {
$return[] = $result;
}
}
}
return $return;
}