You are here

function i18nviews_translate_page_form in Internationalization Views 7.3

Form builder callback for in-place string translation.

1 string reference to 'i18nviews_translate_page_form'
i18nviews_object_translate_page in ./i18nviews.pages.inc
Provide a better organized views translation page grouping strings by display.

File

./i18nviews.pages.inc, line 34
Views translation page

Code

function i18nviews_translate_page_form($form, &$form_state, $view, $strings, $langcode) {

  // Group strings by display
  $groups = array();
  foreach ($strings as $key => $i18nstring) {
    $groups[$i18nstring->objectid][$key] = $i18nstring;
  }

  // The base form adds proper validation and submit callbacks
  $form = i18n_string_translate_page_form_base($form, $langcode);

  // Build the form with one vertical tab per display
  $form['display'] = array(
    '#type' => 'vertical_tabs',
  );
  foreach ($groups as $display_id => $display_strings) {
    $form['groups'][$display_id] = array(
      '#type' => 'fieldset',
      '#title' => views_ui_get_display_label($view, $display_id),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#group' => 'display',
    );
    $form['groups'][$display_id]['strings'] = i18n_string_translate_page_form_strings($display_strings, $langcode);
  }
  $form['submit']['#weight'] = 1;
  $form['#submit'][] = 'views_invalidate_cache';
  return $form;
}