Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi folks,
I'm using variable module to get my module strings editable by the user. At the same time this strings are going to be multilingual. To get my custom variables in the language realm I need to use this snipped:
$controller = variable_realm_controller('language');
$translatable_variables = $controller->getEnabledVariables();
$available_variables = $controller->getAvailableVariables();
$variables = variable_get_info();
foreach($variables as $key => $var) {
if($var['group'] == 'hsjd_custom' &&
$var['localize'] == TRUE &&
in_array($key, $available_variables) &&
!in_array($key, $translatable_variables)) {
$translatable_variables[] = $key;
}
}
$controller->setRealmVariable('list', array_unique($translatable_variables));
My feature requests is to get this into a api function. This one can get as parameter the variable key or the group name and a realm and do this.
what do you think about?
thanks
Comments
Comment #2
yonailo CreditAttribution: yonailo commented+1 to support this !
Comment #3
earthangelconsulting CreditAttribution: earthangelconsulting commented+1 from me too!