Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
drupal.org
strongarm
Commits
3232900b
Commit
3232900b
authored
Jan 05, 2010
by
young hahn
Browse files
Ensuring that site_frontpage exception respects language prefix when making check
parent
baced8fc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
1 deletion
+27
-1
strongarm.module
strongarm.module
+27
-1
No files found.
strongarm.module
View file @
3232900b
...
...
@@ -13,7 +13,7 @@ function strongarm_init() {
// 'site_frontpage' is used. Note that this may be too late if other modules
// weighted even lower than strongarm (which is a superlightweight -1000)
// rely on $_GET['q'] or 'site_frontpage' in hook_init().
$_GET
[
'q'
]
=
$_REQUEST
[
'q'
];
$_GET
[
'q'
]
=
strongarm_language_strip
(
$_REQUEST
[
'q'
]
)
;
drupal_init_path
();
}
...
...
@@ -47,6 +47,32 @@ function strongarm_set_conf($reset = FALSE) {
$conf
=
array_merge
(
$var_conf
,
$conf
);
}
/**
* Remove the language prefix for a given path.
* Strongarm implements this itself as language_initialize() directly affects
* $_GET['q'] and cannot be reused.
*/
function
strongarm_language_strip
(
$path
)
{
// Configured presentation language mode.
$mode
=
variable_get
(
'language_negotiation'
,
LANGUAGE_NEGOTIATION_NONE
);
// Get a list of enabled languages.
$languages
=
language_list
(
'enabled'
);
$languages
=
$languages
[
1
];
if
(
in_array
(
$mode
,
array
(
LANGUAGE_NEGOTIATION_PATH_DEFAULT
,
LANGUAGE_NEGOTIATION_PATH
)))
{
$args
=
explode
(
'/'
,
$path
);
$prefix
=
array_shift
(
$args
);
// Search prefix within enabled languages.
foreach
(
$languages
as
$language
)
{
if
(
!
empty
(
$language
->
prefix
)
&&
$language
->
prefix
==
$prefix
)
{
return
implode
(
'/'
,
$args
);
}
}
}
return
$path
;
}
/**
* Implementation of hook_menu().
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment