mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-06 18:14:16 +00:00
encapsulate icon URL in a function
This commit is contained in:
@@ -236,6 +236,20 @@ function getIcon($aPlace)
|
|||||||
return $aIcons[$sClassPlace] ?? null;
|
return $aIcons[$sClassPlace] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an icon for the given object with its full URL.
|
||||||
|
*/
|
||||||
|
function getIconFile($aPlace)
|
||||||
|
{
|
||||||
|
$sIcon = getIcon($aPlace);
|
||||||
|
|
||||||
|
if (!isset($sIcon)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return CONST_Website_BaseURL.'images/mapicons/'.$sIcon.'.p.20.png';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a class importance value for the given place.
|
* Return a class importance value for the given place.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -903,9 +903,9 @@ class Geocode
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Is there an icon set for this type of result?
|
// Is there an icon set for this type of result?
|
||||||
$sIcon = ClassTypes\getIcon($aResult);
|
$sIcon = ClassTypes\getIconFile($aResult);
|
||||||
if (isset($sIcon)) {
|
if (isset($sIcon)) {
|
||||||
$aResult['icon'] = CONST_Website_BaseURL.'images/mapicons/'.$sIcon.'.p.20.png';
|
$aResult['icon'] = $sIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sLabel = ClassTypes\getLabel($aResult);
|
$sLabel = ClassTypes\getLabel($aResult);
|
||||||
|
|||||||
@@ -57,10 +57,12 @@
|
|||||||
return $sHTML;
|
return $sHTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
function map_icon($sIcon)
|
function map_icon($aPlace)
|
||||||
{
|
{
|
||||||
|
$sIcon = Nominatim\ClassTypes\getIconFile($aPlace);
|
||||||
if (isset($sIcon)) {
|
if (isset($sIcon)) {
|
||||||
echo '<img id="mapicon" src="'.CONST_Website_BaseURL.'images/mapicons/'.$sIcon.'.n.32.png'.'" alt="'.$sIcon.'" />';
|
$sLabel = Nominatim\ClassTypes\getIcon($aPlace);
|
||||||
|
echo '<img id="mapicon" src="'.$sIcon.'" alt="'.$sLabel.'" />';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,7 +114,7 @@
|
|||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-2 text-right">
|
<div class="col-sm-2 text-right">
|
||||||
<?php map_icon($aPointDetails['icon']) ?>
|
<?php map_icon($aPointDetails) ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|||||||
@@ -26,8 +26,9 @@ $aPlaceDetails['calculated_importance'] = (float) $aPointDetails['calculated_imp
|
|||||||
|
|
||||||
$aPlaceDetails['extratags'] = $aPointDetails['aExtraTags'];
|
$aPlaceDetails['extratags'] = $aPointDetails['aExtraTags'];
|
||||||
$aPlaceDetails['calculated_wikipedia'] = $aPointDetails['wikipedia'];
|
$aPlaceDetails['calculated_wikipedia'] = $aPointDetails['wikipedia'];
|
||||||
if (isset($aPointDetails['icon'])) {
|
$sIcon = Nominatim\ClassTypes\getIconFile($aPointDetails);
|
||||||
$aPlaceDetails['icon'] = CONST_Website_BaseURL.'images/mapicons/'.$aPointDetails['icon'].'.n.32.png';
|
if (isset($sIcon)) {
|
||||||
|
$aPlaceDetails['icon'] = $sIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
$aPlaceDetails['rank_address'] = (int) $aPointDetails['rank_address'];
|
$aPlaceDetails['rank_address'] = (int) $aPointDetails['rank_address'];
|
||||||
|
|||||||
@@ -149,7 +149,6 @@ if (!$aPointDetails) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$aPointDetails['localname'] = $aPointDetails['localname']?$aPointDetails['localname']:$aPointDetails['housenumber'];
|
$aPointDetails['localname'] = $aPointDetails['localname']?$aPointDetails['localname']:$aPointDetails['housenumber'];
|
||||||
$aPointDetails['icon'] = Nominatim\ClassTypes\getIcon($aPointDetails);
|
|
||||||
$aPointDetails['rank_search_label'] = getSearchRankLabel($aPointDetails['rank_search']); // only used in HTML format
|
$aPointDetails['rank_search_label'] = getSearchRankLabel($aPointDetails['rank_search']); // only used in HTML format
|
||||||
|
|
||||||
// Get all alternative names (languages, etc)
|
// Get all alternative names (languages, etc)
|
||||||
|
|||||||
Reference in New Issue
Block a user