You are here

function nivo_slider_locale_refresh in Nivo Slider 8

Same name and namespace in other branches
  1. 7 nivo_slider.module \nivo_slider_locale_refresh()

Update / create translation source for user defined slide strings.

Parameters

array $slides: An array of slider slides.

1 call to nivo_slider_locale_refresh()
SlideConfigurationForm::submitForm in src/Form/SlideConfigurationForm.php
Form submission handler.
1 string reference to 'nivo_slider_locale_refresh'
nivo_slider_i18n_string_info in ./nivo_slider.module
Implements hook_i18n_string_info()

File

./nivo_slider.module, line 69
Primarily Drupal hooks.

Code

function nivo_slider_locale_refresh(array $slides = NULL) {
  if (!isset($slides)) {
    $slides = variable_get('nivo_slider_banner_settings', []);
  }
  foreach ($slides as $slide => $settings) {
    foreach ($settings as $setting => $value) {
      switch ($setting) {
        case 'title':
          i18n_string_update('nivo_slider:slide:' . $slide . ':title', $value);
          break;
        case 'description':
          i18n_string_update('nivo_slider:slide:' . $slide . ':description', $value['value'], [
            'format' => $value['format'],
          ]);
          break;
      }
    }
  }
}