function i18n_panels_get_i18n_translation_object in Panels 7.3
Returns the translation object of the pane.
Parameters
stdClass $pane: The pane to deal with.
Return value
stdClass|FALSE Returns FALSE if no translation is necessary.
3 calls to i18n_panels_get_i18n_translation_object()
- i18n_panels_i18n_string_list in i18n_panels/
i18n_panels.module - Implements hook_i18n_string_list().
- i18n_panels_panels_pane_prerender in i18n_panels/
i18n_panels.module - Implements hook_panels_pane_prerender().
- i18n_panels_panels_pane_update in i18n_panels/
i18n_panels.module - Implements hook_panels_pane_update().
File
- i18n_panels/
i18n_panels.module, line 47 - Internationalization (i18n) submodule: Panels translation.
Code
function i18n_panels_get_i18n_translation_object($pane) {
$translation_object = array();
// Handle content type specific i18n settings.
if ($i18n_settings = i18n_panels_get_i18n_settings($pane)) {
// Register translatable settings.
foreach ($i18n_settings as $i18n_setting => $settings) {
if (!is_array($settings)) {
$i18n_setting = $settings;
$settings = array(
'format' => 'plain_text',
);
}
$translation_object[$i18n_setting] = NULL;
$key_exists = FALSE;
// Ensure a nested setting is "unpacked".
$config_value = drupal_array_get_nested_value($pane->configuration, explode('|', $i18n_setting), $key_exists);
// If we reached the end of the nested setting use the value as source.
if ($key_exists) {
$translation_object[$i18n_setting] = array(
'string' => $config_value,
'format' => $settings['format'],
);
$translation_object['panels_i18n_settings'][$i18n_setting] = $settings;
}
}
}
// Check if this pane has a custom title enabled.
if (!empty($pane->configuration['override_title'])) {
$translation_object['title']['string'] = $pane->configuration['override_title_text'];
}
if (!empty($translation_object)) {
return (object) $translation_object;
}
return FALSE;
}