/** * Create the request url. * * It combines the params and creates an hash for it. * * @param int $dataId The data object id. * @param string|null $type Object type. If empty it assumes a layer. * @param string|null $format Data format. If empty it assumes geojson. * @param Filter $filter Optional filter. * * @return RequestUrl */ public static function create($dataId, $type = null, $format = null, Filter $filter = null) { $params = array('for' => static::$for, 'type' => $type != 'layer' ? $type : null, 'id' => $dataId, 'format' => $format != 'geojson' ? $format : null); $hash = base64_encode(implode(',', $params)); $query = 'leaflet=' . $hash; if ($filter) { $query .= '&f=' . $filter->getName() . '&v=' . $filter->toRequest(); } $url = \Config::get('websitePath') . '/' . \Frontend::addToUrl($query, false); return new static($url, $hash, $filter); }
/** * Point to `Frontend::addToUrl()` in front end templates (see #6736) * * @param string $strRequest The request string to be added * @param boolean $blnIgnoreParams If true, the $_GET parameters will be ignored * @param array $arrUnset An optional array of keys to unset * * @return string The new URI string */ public static function addToUrl($strRequest, $blnIgnoreParams = false, $arrUnset = array()) { return \Frontend::addToUrl($strRequest, $blnIgnoreParams, $arrUnset); }
/** * Add some suffix to the current URL. * * @param AddToUrlEvent $event The event. * * @return void */ public static function handleAddToUrl(AddToUrlEvent $event) { $event->setUrl(\Frontend::addToUrl($event->getSuffix(), $event->isIgnoreParams())); }