More generic retrieving of translation links (frontend)
-
Hallo nochmal, Dennis,
for building a language-switching-links in some multipurpose theme or similar i need a triple of language -> url -> current_language as array/object. I don’t found any function/method to get this information unstyled anywhere.
I’ve build a helper, but is there an more easy way to get this infos?
function get_msls_items () { return array_map ( function ( $item ) { $cleaned = str_replace ( '"> ', '">', preg_replace ( "/<img[^>]+\>/i", "", $item ) ); $href = ( array ) ( new SimpleXMLElement ( $cleaned ) ) ['href']; return array ( 'href' => $href[0], 'text' => strip_tags ( $cleaned ), 'current' => ( strpos ( $cleaned, 'current_language' ) ) ? 'current_language' : '' ); }, MslsOutput::init () -> get ( MslsOptions::instance () ) ); }
Thanks,
Christian
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘More generic retrieving of translation links (frontend)’ is closed to new replies.