You are here

function theme_stringoverrides_strings in String Overrides 7

Same name and namespace in other branches
  1. 5 stringoverrides.admin.inc \theme_stringoverrides_strings()
  2. 6 stringoverrides.admin.inc \theme_stringoverrides_strings()

Theme the enabled box and the two text box strings

1 theme call to theme_stringoverrides_strings()
stringoverrides_admin in ./stringoverrides.admin.inc
Menu callback for the String Overrides module to display its administration

File

./stringoverrides.admin.inc, line 201
Admin page callbacks for the String Overrides module.

Code

function theme_stringoverrides_strings($variables) {
  $form = $variables['form'];
  $rows = array();
  foreach (element_children($form) as $key) {

    // Build the table row.
    $rows[$key] = array(
      'data' => array(
        array(
          'data' => drupal_render($form[$key]['enabled']),
          'class' => 'stringoverrides-enabled',
        ),
        array(
          'data' => drupal_render($form[$key]['source']),
          'class' => 'stringoverrides-source',
        ),
        array(
          'data' => drupal_render($form[$key]['translation']),
          'class' => 'stringoverrides-translation',
        ),
        array(
          'data' => drupal_render($form[$key]['context']),
          'class' => 'stringoverrides-context',
        ),
      ),
    );

    // Add any attributes on the element to the row, such as the ahah class.
    if (array_key_exists('#attributes', $form[$key])) {
      $rows[$key] = array_merge($rows[$key], $form[$key]['#attributes']);
    }
  }
  $header = array(
    $form[0]['enabled']['#access'] ? array(
      'data' => t('Enabled'),
      'title' => t('Flag whether the given override should be active.'),
    ) : NULL,
    array(
      'data' => t('Original'),
      'title' => t('The original source text to be replaced.'),
    ),
    array(
      'data' => t('Replacement'),
      'title' => t('The text to replace the original source text.'),
    ),
    array(
      'data' => t('Context'),
      'title' => t('Some strings have context applied to them. In those cases, you can provide the context in this column.'),
    ),
  );
  $output = theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'id' => 'stringoverrides-wrapper',
    ),
  ));
  $output .= drupal_render_children($form);
  return $output;
}