protected function DemoContent::prepareImage in Open Social 8.5
Same name and namespace in other branches
- 8.9 modules/custom/social_demo/src/DemoContent.php \Drupal\social_demo\DemoContent::prepareImage()
- 8.2 modules/custom/social_demo/src/DemoContent.php \Drupal\social_demo\DemoContent::prepareImage()
- 8.3 modules/custom/social_demo/src/DemoContent.php \Drupal\social_demo\DemoContent::prepareImage()
- 8.4 modules/custom/social_demo/src/DemoContent.php \Drupal\social_demo\DemoContent::prepareImage()
- 8.6 modules/custom/social_demo/src/DemoContent.php \Drupal\social_demo\DemoContent::prepareImage()
- 8.7 modules/custom/social_demo/src/DemoContent.php \Drupal\social_demo\DemoContent::prepareImage()
- 8.8 modules/custom/social_demo/src/DemoContent.php \Drupal\social_demo\DemoContent::prepareImage()
- 10.3.x modules/custom/social_demo/src/DemoContent.php \Drupal\social_demo\DemoContent::prepareImage()
- 10.0.x modules/custom/social_demo/src/DemoContent.php \Drupal\social_demo\DemoContent::prepareImage()
- 10.1.x modules/custom/social_demo/src/DemoContent.php \Drupal\social_demo\DemoContent::prepareImage()
- 10.2.x modules/custom/social_demo/src/DemoContent.php \Drupal\social_demo\DemoContent::prepareImage()
Prepares data about an image.
Parameters
string $picture: The image uuid.
string $alt: The image alt text.
Return value
array Returns an array for the image field.
7 calls to DemoContent::prepareImage()
- Book::getEntry in modules/
custom/ social_demo/ src/ Plugin/ DemoContent/ Book.php - Makes an array with data of an entity.
- DemoGroup::createContent in modules/
custom/ social_demo/ src/ DemoGroup.php - Creates content.
- DemoSystem::replaceAnBlock in modules/
custom/ social_demo/ src/ DemoSystem.php - Function to replace the AN homepage Block.
- DemoUser::createContent in modules/
custom/ social_demo/ src/ DemoUser.php - Creates content.
- 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/ DemoContent.php, line 256
Class
- DemoContent
- Class DemoContent.
Namespace
Drupal\social_demoCode
protected function prepareImage($picture, $alt = '') {
$value = NULL;
$files = $this
->loadByUuid('file', $picture);
if ($files instanceof File) {
$value = [
[
'target_id' => $files
->id(),
'alt' => $alt ?: 'file' . $files
->id(),
],
];
}
return $value;
}