This is very unuseful to not having access to sfContext in the Symfony 1.4 forms for many reasons, for example to check whether user logged in or not or check user credentials and show/hide form widgets/validators. Continue reading “How to Get sfContext in Symfony 1.4 form – Inject Your Dependency!”
Symfony 1.4 skip sf_culture in URL for main language with overridden sfPatternRouting class
If you have i18n website and want to have language in the URL _BUT_ want to skip main language to be in the URL you need some custom solution.
WordPress, WPML and Widget Title Link plugin
If you need to have your widget titles a links but you have multi language website with WPML plugin you can use a plugin “Widget Title Links” by Ragulka and my small code snippet, please add this to your theme’s functions.php:
add_filter('widget_title_link', 'wpml_widget_title_link'); function wpml_widget_title_link($title_link) { // this removes http:// because it is added by esc_url in widget-title-link.php:L88 $title_link = preg_replace('/https?:\/\//', '', $title_link); // this WPML helper generates link to translated post/page/category/etc WP object $link = icl_link_to_element( $title_link, $element_type = 'post', $link_text = '', $optional_parameters = array(), $anchor = '', $echoit = false, $return_original_if_missing = true ); // this cuts URL from a generated link if (preg_match('/href="([^"]+)"/', $link, $matches)) { return $matches[1]; } else { return false; } }
After that you can specify WP Object ID in the widget “Title link” field and WPML will find translated object and create URL for widget title: