public function LeafletService::setFeatureIconSizesIfEmptyOrInvalid in Leaflet 2.0.x
Same name and namespace in other branches
- 2.1.x src/LeafletService.php \Drupal\leaflet\LeafletService::setFeatureIconSizesIfEmptyOrInvalid()
Set Feature Icon Size & Shadow Size If Empty or Invalid.
Parameters
$feature:
File
- src/
LeafletService.php, line 341
Class
- LeafletService
- Provides a LeafletService class.
Namespace
Drupal\leafletCode
public function setFeatureIconSizesIfEmptyOrInvalid(&$feature) : void {
if (isset($feature["icon"]["iconSize"]) && (empty(intval($feature["icon"]["iconSize"]["x"])) && empty(intval($feature["icon"]["iconSize"]["y"]))) && (!empty($feature["icon"]["iconUrl"]) && $this
->fileExists($feature["icon"]["iconUrl"]))) {
$iconSize = getimagesize($feature["icon"]["iconUrl"]);
$feature["icon"]["iconSize"]["x"] = $iconSize[0];
$feature["icon"]["iconSize"]["y"] = $iconSize[1];
}
if (isset($feature["icon"]["shadowSize"]) && (empty(intval($feature["icon"]["shadowSize"]["x"])) && empty(intval($feature["icon"]["shadowSize"]["y"]))) && (!empty($feature["icon"]["shadowUrl"]) && $this
->fileExists($feature["icon"]["shadowUrl"]))) {
$shadowSize = getimagesize($feature["icon"]["iconUrl"]);
$feature["icon"]["shadowSize"]["x"] = $shadowSize[0];
$feature["icon"]["shadowSize"]["y"] = $shadowSize[1];
}
}