public function EntityHelper::getEntityImageUrls in Simple XML sitemap 8.2
Parameters
$entity_type_name:
$entity_id:
Return value
array
File
- src/
EntityHelper.php, line 120
Class
- EntityHelper
- Class EntityHelper @package Drupal\simple_sitemap
Namespace
Drupal\simple_sitemapCode
public function getEntityImageUrls($entity_type_name, $entity_id) {
$query = $this->db
->select('file_managed', 'fm');
$query
->fields('fm', [
'uri',
]);
$query
->join('file_usage', 'fu', 'fu.fid = fm.fid');
$query
->condition('fm.filemime', 'image/%', 'LIKE');
$query
->condition('fu.type', $entity_type_name);
$query
->condition('fu.id', $entity_id);
foreach ($query
->execute() as $row) {
$imageUris[] = file_create_url($row->uri);
}
return !empty($imageUris) ? $imageUris : [];
}