Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezpLanguageSwitcherFunctionCollection.php
Go to the documentation of this file.
1 <?php
12 class ezpLanguageSwitcherFunctionCollection
13 {
14 public function fetchUrlAlias( $nodeId, $path, $locale )
15 {
16 if ( !$nodeId && !$path )
17 {
18 return array( 'result' => false );
19 }
20
21 if ( empty( $locale ) || !is_string( $locale ) )
22 {
23 return array( 'result' => false );
24 }
25
26 if ( is_numeric( $nodeId ) )
27 {
28 $destinationElement = eZURLAliasML::fetchByAction( 'eznode', $nodeId, $locale, false );
29 }
30 else if ( is_string( $path ) )
31 {
32 $nodeId = eZURLAliasML::fetchNodeIDByPath( $path );
33 $destinationElement = eZURLAliasML::fetchByAction( 'eznode', $nodeId, $locale, false );
34 }
35
36 if ( empty( $destinationElement ) || ( !isset( $destinationElement[0] ) && !( $destinationElement[0] instanceof eZURLAliasML ) ) )
37 {
38 // Either no translation exists for $locale or $path was not pointing to a node
39 return array( 'result' => false );
40 }
41
42 $currentLanguageCodes = eZContentLanguage::prioritizedLanguageCodes();
43 array_unshift( $currentLanguageCodes, $locale );
44 $currentLanguageCodes = array_unique( $currentLanguageCodes );
45 $urlAlias = $destinationElement[0]->getPath( $locale, $currentLanguageCodes );
46 return array( 'result' => $urlAlias );
47 }
48 }
49
50 ?>
$locale
$locale
Definition: admin/adlist.php:127
eZContentLanguage\prioritizedLanguageCodes
static prioritizedLanguageCodes()
Definition: ezcontentlanguage.php:362
ezpLanguageSwitcherFunctionCollection
Definition: ezpLanguageSwitcherFunctionCollection.php:13
ezpLanguageSwitcherFunctionCollection\fetchUrlAlias
fetchUrlAlias( $nodeId, $path, $locale)
Definition: ezpLanguageSwitcherFunctionCollection.php:14
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.