Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-18686

PathPrefix is not removed from url by ezpLanguageSwitcher

    XMLWordPrintable

Details

    Description

      When a PathPrefix setting is set in the destination siteaccess , the destinationUrl() function in the ezpLanguageSwitcher class does not remove the PathPrefix from the $urlAlias variable.

      I used the following workaround in kernel/private/classes/ezplanguageswitcher.php :

      public function destinationUrl()
      {
      .....
      $urlAlias = $destinationElement[0]>getPath( $this>destinationLocale, $siteLanguageList );

      // remove pathPrefix from url
      $sitePathPrefix = $saIni->variable( 'SiteAccessSettings', 'PathPrefix' );
      $urlAliasArray = explode ( '/' , $urlAlias);

      if ( in_array($sitePathPrefix,$urlAliasArray) )

      { unset($urlAliasArray[0]); $urlAlias = implode('/',$urlAliasArray); }

      ......
      }

      It would be a good idea to have the pathPrefix automatically checked by the languageswitcher in future versions.

      Steps to reproduce
      • create multiple siteaccess with differents ContentObjectLocale
      • specify a PathPrefix in each siteaccess
      • translate an object
      • use the /switchlanguage/to/$destinationSiteaccess/$node_id function to get the url alias of a node in the destination siteaccess

      Attachments

        Activity

          People

            unknown unknown
            supasteevo supasteevo
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: