You are here

function i18n_translation_admin_form in Internationalization 7

Admin form

1 call to i18n_translation_admin_form()
i18n_translation_set_overview in i18n_translation/i18n_translation.module
Translation set generic form
1 string reference to 'i18n_translation_admin_form'
i18n_translation_admin_overview in i18n_translation/i18n_translation.admin.inc
Overview page for translation sets

File

i18n_translation/i18n_translation.admin.inc, line 50
Internationalization (i18n) module. Translation sets admin

Code

function i18n_translation_admin_form($form, &$form_state, $translations, $header) {
  $destination = drupal_get_destination();
  $rows = array();
  foreach ($translations as $set) {
    $info = i18n_object_info($set->type);
    $rows[$set->tsid]['title'] = check_plain($set
      ->get_title());
    if (isset($header['type'])) {
      $rows[$set->tsid]['type'] = isset($info['title']) ? $info['title'] : t('Unknown');
    }
    $rows[$set->tsid]['items'] = ($items = $set
      ->get_links()) ? theme('links', array(
      'links' => $items,
    )) : '';
    $rows[$set->tsid] += array(
      'created' => format_date($set->created, 'short'),
      'changed' => format_date($set->changed, 'short'),
      'operations' => '',
    );

    // Build a list of all the accessible operations for the current set.
    $operations = $set
      ->get_operations();
    if (count($operations) > 1) {

      // Render an unordered list of operations links.
      $rows[$set->tsid]['operations'] = array(
        'data' => array(
          '#theme' => 'links__node_operations',
          '#links' => $operations,
          '#attributes' => array(
            'class' => array(
              'links',
              'inline',
            ),
          ),
        ),
      );
    }
    elseif (!empty($operations)) {

      // Render the first and only operation as a link.
      $link = reset($operations);
      $rows[$set->tsid]['operations'] = array(
        'data' => array(
          '#type' => 'link',
          '#title' => $link['title'],
          '#href' => $link['href'],
          '#options' => array(
            'query' => $link['query'],
          ),
        ),
      );
    }
  }
  $form['translations'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#empty' => t('No translation sets available.'),
  );
  return $form;
}