generateFrontendUrl() public static method

Generate a front end URL
Deprecation: Deprecated since Contao 4.2, to be removed in Contao 5.0. Use the contao.routing.url_generator service or PageModel::getFrontendUrl() instead.
public static generateFrontendUrl ( array $arrRow, string $strParams = null, string $strForceLang = null, boolean $blnFixDomain = false ) : string
$arrRow array An array of page parameters
$strParams string An optional string of URL parameters
$strForceLang string Force a certain language
$blnFixDomain boolean Check the domain of the target page and append it if necessary
return string An URL that can be used in the front end
示例#1
0
 /**
  * Generate a front end URL
  *
  * @param string $strParams    An optional string of URL parameters
  * @param string $strForceLang Force a certain language
  *
  * @return string An URL that can be used in the front end
  */
 public function getFrontendUrl($strParams = null, $strForceLang = null)
 {
     return \Controller::generateFrontendUrl($this->row(), $strParams, $strForceLang);
 }
 /**
  * Generate a frontend url.
  *
  * @param GenerateFrontendUrlEvent $event The event.
  *
  * @return void
  */
 public function handleGenerateFrontendUrl(GenerateFrontendUrlEvent $event)
 {
     $url = Controller::generateFrontendUrl($event->getPageData(), $event->getParameters(), $event->getLanguage(), $event->getFixDomain());
     $event->setUrl($url);
 }