[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/admin/theme/ -> template.php (source)

   1  <?php
   2  // $Id: template.php,v 1.1.2.3 2009/07/14 11:35:03 karens Exp $
   3  
   4  /**
   5   * Display the list of available node types for node creation.
   6   */
   7  function slate_node_add_list($content) {
   8    $output = '';
   9    if ($content) {
  10      $output = '<ul class="node-type-list">';
  11      foreach ($content as $item) {
  12        $output .= "<li class='clear-block'>";
  13        $output .= '<label>'. l($item['title'], $item['href'], $item['localized_options']) .'</label>';
  14        $output .= '<div class="description">'. filter_xss_admin($item['description']) .'</div>';
  15        $output .= "</li>";
  16      }
  17      $output .= '</ul>';
  18    }
  19    return $output;
  20  }
  21  
  22  /**
  23   * Override of theme_admin_block_content().
  24   */
  25  function slate_admin_block_content($content, $get_runstate = FALSE) {
  26    static $has_run = FALSE;
  27    if ($get_runstate) {
  28      return $has_run;
  29    }
  30    $has_run = TRUE;
  31    $output = '';
  32    if (!empty($content)) {
  33      foreach ($content as $k => $item) {
  34        $id = str_replace('/', '-', $item['href']);
  35        $class = ' path-'. $id;
  36  
  37        $content[$k]['title'] = "<span class='icon'></span>{$item['title']}";
  38        $content[$k]['localized_options']['html'] = TRUE;
  39        if (!empty($content[$k]['localized_options']['attributes']['class'])) {
  40          $content[$k]['localized_options']['attributes']['class'] .= $class;
  41        }
  42        else {
  43          $content[$k]['localized_options']['attributes']['class'] = $class;
  44        }
  45      }
  46      $output = system_admin_compact_mode() ? '<ul class="menu">' : '<ul class="admin-list">';
  47      foreach ($content as $item) {
  48        $output .= '<li class="leaf">';
  49        $output .= l($item['title'], $item['href'], $item['localized_options']);
  50        if (!system_admin_compact_mode()) {
  51          $output .= "<div class='description'>{$item['description']}</div>";
  52        }
  53        $output .= '</li>';
  54      }
  55      $output .= '</ul>';
  56    }
  57    return $output;
  58  }
  59  
  60  /**
  61   * Override of theme_system_settings_form().
  62   * Group buttons together @ the bottom.
  63   */
  64  function slate_system_settings_form($form) {
  65    $buttons = '<div class="buttons">'. drupal_render($form['buttons']) .'</div>';
  66    return drupal_render($form) . $buttons;
  67  }
  68  
  69  /**
  70   * Override of theme_node_form().
  71   */
  72  function slate_node_form($form) {
  73    $buttons = '<div class="buttons">'. drupal_render($form['buttons']) .'</div>';
  74    
  75    // Allow modules to insert form elements into the sidebar,
  76    // defaults to showing taxonomy in that location.
  77    if (!$sidebar_fields = module_invoke_all('node_form_sidebar', $form, $form['#node'])) {
  78      $sidebar_fields = array('taxonomy');
  79    }
  80    foreach ($sidebar_fields as $field) {
  81      $sidebar .= drupal_render($form[$field]);
  82    }
  83    
  84    $main = drupal_render($form);
  85    return "<div class='node-form clear-block'>
  86      <div class='right'>{$buttons}{$sidebar}</div>
  87      <div class='left'><div class='main'>{$main}{$buttons}</div></div>
  88    </div>";
  89  }
  90  
  91  /**
  92   * Override of theme_fieldset().
  93   */
  94  function slate_fieldset(&$element) {
  95    $attr = isset($element['#attributes']) ? $element['#attributes'] : array();
  96    $attr['class'] = !empty($attr['class']) ? $attr['class'] : '';
  97    $attr['class'] .= ' fieldset';
  98    $attr['class'] .= !empty($element['#collapsible']) || !empty($element['#collapsed']) ? ' collapsible' : '';
  99    $attr['class'] .= !empty($element['#collapsed']) ? ' collapsed' : '';
 100    $attr = drupal_attributes($attr);
 101  
 102    $description = !empty($element['#description']) ? "<div class='description'>{$element['#description']}</div>" : '';
 103    $children = !empty($element['#children']) ? $element['#children'] : '';
 104    $value = !empty($element['#value']) ? $element['#value'] : '';
 105    $content = $description . $children . $value;
 106  
 107    $title = !empty($element['#title']) ? $element['#title'] : '';
 108    if (!empty($element['#collapsible']) || !empty($element['#collapsed'])) {
 109      $title = l($title, $_GET['q'], array('fragment' => 'fieldset'));
 110    }
 111  
 112    $output = "<div $attr>";
 113    $output .= $title ? "<h2 class='fieldset-title'>$title</h2>" : '';
 114    $output .= "<div class='fieldset-content clear-block'>$content</div>";
 115    $output .= "</div>";
 116    return $output;
 117  }
 118  
 119  /**
 120   * Theme function for manage options on admin/content/node, admin/user/user.
 121   */
 122  function slate_admin_manage_options($form) {
 123    $output = "<div class='clear-block admin-options'>";
 124    $output .= "<label>{$form['#title']}</label>";
 125    foreach (element_children($form) as $id) {
 126      $output .= drupal_render($form[$id]);
 127    }
 128    $output .= "</div>";
 129    return $output;
 130  }


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7