protected function Event::prepareAttachment in Open Social 8.6
Same name and namespace in other branches
- 8.9 modules/custom/social_demo/src/Plugin/DemoContent/Event.php \Drupal\social_demo\Plugin\DemoContent\Event::prepareAttachment()
- 8 modules/custom/social_demo/src/Plugin/DemoContent/Event.php \Drupal\social_demo\Plugin\DemoContent\Event::prepareAttachment()
- 8.2 modules/custom/social_demo/src/Plugin/DemoContent/Event.php \Drupal\social_demo\Plugin\DemoContent\Event::prepareAttachment()
- 8.3 modules/custom/social_demo/src/Plugin/DemoContent/Event.php \Drupal\social_demo\Plugin\DemoContent\Event::prepareAttachment()
- 8.4 modules/custom/social_demo/src/Plugin/DemoContent/Event.php \Drupal\social_demo\Plugin\DemoContent\Event::prepareAttachment()
- 8.5 modules/custom/social_demo/src/Plugin/DemoContent/Event.php \Drupal\social_demo\Plugin\DemoContent\Event::prepareAttachment()
- 8.7 modules/custom/social_demo/src/Plugin/DemoContent/Event.php \Drupal\social_demo\Plugin\DemoContent\Event::prepareAttachment()
- 8.8 modules/custom/social_demo/src/Plugin/DemoContent/Event.php \Drupal\social_demo\Plugin\DemoContent\Event::prepareAttachment()
- 10.3.x modules/custom/social_demo/src/Plugin/DemoContent/Event.php \Drupal\social_demo\Plugin\DemoContent\Event::prepareAttachment()
- 10.0.x modules/custom/social_demo/src/Plugin/DemoContent/Event.php \Drupal\social_demo\Plugin\DemoContent\Event::prepareAttachment()
- 10.1.x modules/custom/social_demo/src/Plugin/DemoContent/Event.php \Drupal\social_demo\Plugin\DemoContent\Event::prepareAttachment()
- 10.2.x modules/custom/social_demo/src/Plugin/DemoContent/Event.php \Drupal\social_demo\Plugin\DemoContent\Event::prepareAttachment()
Returns reference to attachment, possibly with a description.
Parameters
array $files: Array with UUIDs of files.
Return value
array|null Array containing related files or NULL.
1 call to Event::prepareAttachment()
- Event::getEntry in modules/
custom/ social_demo/ src/ Plugin/ DemoContent/ Event.php - Makes an array with data of an entity.
File
- modules/
custom/ social_demo/ src/ Plugin/ DemoContent/ Event.php, line 123
Class
- Event
- Event Plugin for demo content.
Namespace
Drupal\social_demo\Plugin\DemoContentCode
protected function prepareAttachment(array $files) {
$attachments = NULL;
foreach ($files as $file) {
$description = '';
// If it is an array, this means we also have a description.
if (is_array($file)) {
$uuid = key($file);
$description = current($file);
}
else {
$uuid = $file;
}
$object = $this->fileStorage
->loadByProperties([
'uuid' => $uuid,
]);
if ($object) {
$properties = [
'target_id' => current($object)
->id(),
'description' => $description,
];
$attachments[] = $properties;
}
}
return $attachments;
}