Created
July 1, 2014 14:32
-
-
Save csakiistvan/669c3e33e3b5c89df0f9 to your computer and use it in GitHub Desktop.
how to create a translatable drupal pane title
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 | |
| /** | |
| * Implements hook_preprocess_panels_pane(). | |
| */ | |
| function hook_preprocess_panels_pane(&$vars) { | |
| // Allow translation before substitution. | |
| if ( | |
| !empty($vars['pane']->configuration['override_title']) | |
| && !empty($vars['pane']->configuration['override_title_text']) | |
| && module_exists('ctools') | |
| ) { | |
| $raw = $vars['pane']->configuration['override_title_text']; | |
| // @codingStandardsIgnoreStart | |
| $raw_translated = t($raw); | |
| // @codingStandardsIgnoreEnd | |
| $context = isset($vars['display']->context) ? $vars['display']->context : array(); | |
| $vars['title'] = filter_xss_admin(ctools_context_keyword_substitute($raw_translated, array(), $context)); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment