protected function EntityUrlGeneratorBase::getEntityImageData in Simple XML sitemap 8.3
Same name and namespace in other branches
- 4.x src/Plugin/simple_sitemap/UrlGenerator/EntityUrlGeneratorBase.php \Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator\EntityUrlGeneratorBase::getEntityImageData()
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity:
Return value
array
3 calls to EntityUrlGeneratorBase::getEntityImageData()
- CustomUrlGenerator::processDataSet in src/
Plugin/ simple_sitemap/ UrlGenerator/ CustomUrlGenerator.php - @inheritdoc
- EntityMenuLinkContentUrlGenerator::processDataSet in src/
Plugin/ simple_sitemap/ UrlGenerator/ EntityMenuLinkContentUrlGenerator.php - @inheritdoc
- EntityUrlGenerator::processDataSet in src/
Plugin/ simple_sitemap/ UrlGenerator/ EntityUrlGenerator.php - @inheritdoc
File
- src/
Plugin/ simple_sitemap/ UrlGenerator/ EntityUrlGeneratorBase.php, line 222
Class
- EntityUrlGeneratorBase
- Class EntityUrlGeneratorBase @package Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator
Namespace
Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGeneratorCode
protected function getEntityImageData(ContentEntityInterface $entity) {
$image_data = [];
foreach ($entity
->getFieldDefinitions() as $field) {
if ($field
->getType() === 'image') {
foreach ($entity
->get($field
->getName())
->getValue() as $value) {
if (!empty($file = File::load($value['target_id']))) {
$image_data[] = [
'path' => $this
->replaceBaseUrlWithCustom(file_create_url($file
->getFileUri())),
'alt' => $value['alt'],
'title' => $value['title'],
];
}
}
}
}
return $image_data;
}