You are here

function theme_print_ui_settings in Printer, email and PDF versions 7.2

Returns HTML for the link settings page.

Parameters

array $variables: An associative array containing:

  • form: A render element representing the form.

Return value

string HTML for the link settings page.

Related topics

File

print_ui/print_ui.admin.inc, line 157
Contains the administrative functions of the print UI module.

Code

function theme_print_ui_settings($variables) {
  $form = $variables['form'];
  $header = array(
    '',
  );
  foreach (module_implements('print_link') as $module) {
    $function = $module . '_print_link';
    if (function_exists($function)) {
      $link = call_user_func_array($function, array());
      $header[] = array(
        'data' => $link['format'],
        'class' => 'checkbox',
      );
    }
  }
  foreach (element_children($form['settings']) as $group) {
    $rows = array();
    foreach (element_children($form['settings'][$group]) as $elem) {
      $row = array();
      foreach (module_implements('print_link') as $module) {
        $function = $module . '_print_link';
        if (function_exists($function)) {
          $link = call_user_func_array($function, array());
          $format = $link['format'];
          $item = $form['settings'][$group][$elem]['print_' . $format . '_' . $elem];
          if (empty($row)) {

            // Start row, fill title and description.
            $row_desc = array(
              '#type' => 'item',
              '#markup' => isset($item['#title']) ? $item['#title'] : '',
              '#description' => isset($item['#description']) ? $item['#description'] : '',
            );
            $row[] = array(
              'data' => drupal_render($row_desc),
              'class' => array(
                '',
              ),
            );
          }
          $item['#title_display'] = 'invisible';
          $item['#description'] = '';
          $class = $item['#type'] == 'checkbox' ? 'checkbox' : '';
          $row[] = array(
            'data' => drupal_render($item),
            'class' => array(
              $class,
            ),
          );
        }
      }
      $rows[] = $row;
    }
    $form['settings'][$group]['#children'] = theme('table', array(
      'header' => $header,
      'rows' => $rows,
      'attributes' => array(
        'id' => 'permissions',
      ),
    ));
  }
  $output = drupal_render_children($form);
  return $output;
}