You are here

function theme_domain_theme_form in Domain Access 7.3

Same name and namespace in other branches
  1. 7.2 domain_theme/domain_theme.admin.inc \theme_domain_theme_form()

FormsAPI theming.

File

domain_theme/domain_theme.admin.inc, line 137
Include file to handle theme configuration screen

Code

function theme_domain_theme_form($variables) {
  $form = $variables['form'];
  $output = '';
  $output .= drupal_render($form['intro']);
  $themes = system_rebuild_theme_data();
  $header = array(
    t('Screenshot'),
    t('Theme'),
    t('Default'),
    t('Options'),
  );
  $rows = array();
  foreach (element_children($form['theme']) as $key) {
    $default = '';
    if ($form['theme'][$key]['#value'] == $key) {
      $default = t('(default theme)');
    }
    $screenshot = $themes[$key]->info['screenshot'];

    // With sub-theming, screenshot may be inherited from base theme
    if (!is_file($screenshot) && !empty($themes[$key]->info['base theme']) && isset($themes[$themes[$key]->info['base theme']])) {
      $screenshot = $themes[$themes[$key]->info['base theme']]->info['screenshot'];
    }

    // Add image attributes.
    $screenshot_options = array(
      'path' => $screenshot,
      'alt' => $themes[$key]->info['name'],
      'title' => $themes[$key]->info['name'],
      'attributes' => array(
        'class' => 'screenshot',
      ),
    );
    $row = array(
      theme('image', $screenshot_options),
      '<h3>' . $themes[$key]->info['name'] . ' ' . (isset($themes[$key]->info['version']) ? $themes[$key]->info['version'] : '') . ' ' . $default . '</h3>' . t($themes[$key]->info['description']),
      drupal_render($form['theme'][$key]),
      l(t('configure'), 'admin/structure/domain/view/' . $form['domain_id']['#value'] . '/theme/' . $key . '/theme-settings'),
    );
    $rows[] = array(
      'data' => $row,
      'class' => array(
        'theme-selector',
      ),
    );
  }
  $output .= theme('table', array(
    'header' => $header,
    'rows' => $rows,
  ));
  $output .= drupal_render_children($form);
  return $output;
}