protected function DemoGroup::prepareFiles in Open Social 10.0.x
Same name and namespace in other branches
- 8.9 modules/custom/social_demo/src/DemoGroup.php \Drupal\social_demo\DemoGroup::prepareFiles()
- 8 modules/custom/social_demo/src/DemoGroup.php \Drupal\social_demo\DemoGroup::prepareFiles()
- 8.2 modules/custom/social_demo/src/DemoGroup.php \Drupal\social_demo\DemoGroup::prepareFiles()
- 8.3 modules/custom/social_demo/src/DemoGroup.php \Drupal\social_demo\DemoGroup::prepareFiles()
- 8.4 modules/custom/social_demo/src/DemoGroup.php \Drupal\social_demo\DemoGroup::prepareFiles()
- 8.5 modules/custom/social_demo/src/DemoGroup.php \Drupal\social_demo\DemoGroup::prepareFiles()
- 8.6 modules/custom/social_demo/src/DemoGroup.php \Drupal\social_demo\DemoGroup::prepareFiles()
- 8.7 modules/custom/social_demo/src/DemoGroup.php \Drupal\social_demo\DemoGroup::prepareFiles()
- 8.8 modules/custom/social_demo/src/DemoGroup.php \Drupal\social_demo\DemoGroup::prepareFiles()
- 10.3.x modules/custom/social_demo/src/DemoGroup.php \Drupal\social_demo\DemoGroup::prepareFiles()
- 10.1.x modules/custom/social_demo/src/DemoGroup.php \Drupal\social_demo\DemoGroup::prepareFiles()
- 10.2.x modules/custom/social_demo/src/DemoGroup.php \Drupal\social_demo\DemoGroup::prepareFiles()
Prepares an array with list of files to set as field value.
Parameters
string $files: The uuid for the file.
Return value
array Returns an array.
1 call to DemoGroup::prepareFiles()
- DemoGroup::createContent in modules/
custom/ social_demo/ src/ DemoGroup.php - Creates content.
File
- modules/
custom/ social_demo/ src/ DemoGroup.php, line 214
Class
- DemoGroup
- Class DemoGroup.
Namespace
Drupal\social_demoCode
protected function prepareFiles($files) {
$values = [];
foreach ($files as $file_uuid) {
$file = $this->fileStorage
->loadByProperties([
'uuid' => $file_uuid,
]);
if ($file) {
$values[] = [
'target_id' => current($file)
->id(),
];
}
}
return $values;
}