Created
May 27, 2014 17:23
-
-
Save csakiistvan/7fbbc99b61dcfb3d90bd to your computer and use it in GitHub Desktop.
Facebook like for multilanguage drupal website
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="fb-like" data-href="#" data-layout="standard" data-action="like" data-show-faces="false" data-share="true"></div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div id="fb-root"></div> | |
| <script>(function(d, s, id) { | |
| var js, fjs = d.getElementsByTagName(s)[0]; | |
| if (d.getElementById(id)) return; | |
| js = d.createElement(s); js.id = id; | |
| js.src = "//connect.facebook.net/<?php print $facebook_language; ?>/all.js#xfbml=1"; | |
| fjs.parentNode.insertBefore(js, fjs); | |
| }(document, 'script', 'facebook-jssdk'));</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Override or insert variables into the html templates. | |
| * | |
| * @param $variables | |
| * An array of variables to pass to the theme template. | |
| * @param $hook | |
| * The name of the template being rendered ("html" in this case.) | |
| */ | |
| function theme_preprocess_html(&$variables, $hook) { | |
| $facebook_languages = array( | |
| 'en' => 'en_US', | |
| 'hu' => 'hu_HU', | |
| ); | |
| $variables['facebook_language'] = $facebook_languages[$variables['language']->language]; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment