public function onLocationGetInfo(object $location) : void

Fires while fetching the details of a specific location.


Description

This hook can be used to manipulate the location details and the full address strings at runtime.

It is suggested to override the following properties in case the default format is not suitable to a specific area: $location->text and $location->short.


Parameters

$location

(object)  An object holding the location details.

  • id - the ID of the location;
  • name - the name of the location;
  • id_employee - the employee assigned to the location (0 if global);
  • id_country - the country ID;
  • countryName - the country name;
  • countryCode2 - the country 2-letters code;
  • countryCode3 - the country 3-letters code;
  • id_state - the state/province ID;
  • stateName - the state/province name;
  • stateCode2 - the state/province 2-letters code;
  • id_city - the city ID;
  • cityName - the city name;
  • address - the address string, which might contain the city name in case a city record was not created;
  • zip - the ZIP code;
  • longitude - the longitude (in degrees);
  • latitude - the latitude (in degrees);
  • text - create an extended text of the full address, built as [ADDRESS], [ZIP] [CITY] [STATE], [COUNTRY];
  • short - create a short text of the address [ADDRESS], [ZIP] [CITY].

Return Value

None.


Example

/**
 * This hook can be used to manipulate the location details and the
 * full address strings at runtime. It is suggested to override the
 * following properties in case the default format is not suitable
 * to a specific area:
 *
 * $location->text
 * $location->short
 *
 * @param   object  $location  The location object.
 *
 * @return  void
 */
public function onLocationGetInfo($location)
{
    /**
     * @todo it is possible to manipulate here the $location object
     */
}

Changelog

VersionDescription
1.7 Introduced.
Last Update: 2021-10-08 13:06
Helpful?