File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ function eZTranslationsFilter()
9
9
function createSqlParts ( $ params )
10
10
{
11
11
$ sqlJoins = '' ;
12
+ $ is_or_logic = isset ( $ params ['or ' ] ) && ( $ params ['or ' ] === true );
12
13
13
14
if ( isset ( $ params ['locales ' ] ) )
14
15
{
@@ -23,7 +24,8 @@ function createSqlParts( $params )
23
24
}
24
25
if ( $ language_mask )
25
26
{
26
- $ sqlJoins = " ezcontentobject.language_mask & $ language_mask AND " ;
27
+ $ sqlJoins = ( $ is_or_logic ) ? " ezcontentobject.language_mask & $ language_mask AND " :
28
+ " ezcontentobject.language_mask & $ language_mask = $ language_mask AND " ;
27
29
}
28
30
}
29
31
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ classname - A list of class identifiers separated by a colon
15
15
depth - Max level of depth to fetch nodes from (default is current folder only)
16
16
ignore_visibility - Fetch also hidden nodes
17
17
locales - List of translation locale codes to filter on, separated by a colon (ex."nor-NO:eng-GB")
18
+ The first locales parameter can be an optional "or" or "and", to specify the logic between the languages (default is "or")
18
19
' ;
19
20
}
20
21
@@ -65,8 +66,14 @@ function getObjectList()
65
66
}
66
67
if ( !empty ( $ this ->locales ) )
67
68
{
69
+ $ is_or_logic = true ;
70
+ if ( $ this ->locales [0 ] == 'and ' OR $ this ->locales [0 ] == 'or ' )
71
+ {
72
+ $ is_or_logic = !( array_shift ( $ this ->locales ) == 'and ' );
73
+ }
68
74
$ parameters ['extended_attribute_filter ' ] = array ( 'id ' => 'TranslationsFilter ' ,
69
- 'params ' => array ( 'locales ' => $ this ->locales ) );
75
+ 'params ' => array ( 'or ' => $ is_or_logic ,
76
+ 'locales ' => $ this ->locales ) );
70
77
}
71
78
return eZFunctionHandler::execute ( 'content ' , 'list ' , $ parameters );
72
79
}
You can’t perform that action at this time.
0 commit comments