English (United Kingdom)

apply_filters( 'vikappointments_location_get_info', bool $status, object $location )

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

$status

(bool)  True on success, false otherwise.

$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].

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  boolean  $status    True on success, false otherwise.
 * @param  object   $location  The location object.
 */
add_filter('vikappointments_location_get_info', function($status, $location)
{
    /**
     * @todo it is possible to manipulate here the $location object
     */

    return true;
}, 10, 2);

Changelog

Version Description
1.2 Introduced.
Last Update: 2021-10-08
Helpful?
This site uses cookies. By continuing to browse you accept their use. Further information