You are here

function theme_patterns_patterns_fieldset in Patterns 7

Same name and namespace in other branches
  1. 7.2 theme/theme.inc \theme_patterns_patterns_fieldset()

Returns HTML for the modules form.

Parameters

$variables: An associative array containing:

  • form: A render element representing the form.
3 theme calls to theme_patterns_patterns_fieldset()
patterns_list_patterns_2 in theme/common.inc
theme_patterns_category_table in theme/theme.inc
theme_patterns_list in theme/theme.inc
Theme a list of patterns into separated fieldset ordered by category

File

theme/theme.inc, line 203

Code

function theme_patterns_patterns_fieldset($variables) {
  $form = $variables['form'];

  // Individual table headers.
  $rows = array();

  // Iterate through all the modules, which are
  // children of this fieldset.
  foreach (element_children($form) as $key) {

    // Stick it into $pattern for easier accessing.
    $pattern = $form[$key];
    $row = array();
    unset($pattern['enable']['#title']);
    $row[] = array(
      'class' => array(
        'checkbox',
      ),
      'data' => drupal_render($pattern['enable']),
    );
    $label = '<label ';
    if (isset($pattern['enable']['#id'])) {
      $label .= ' for="' . $pattern['enable']['#id'] . '"';
    }
    $row[] = drupal_render($pattern['format']);
    $row[] = $label . '><strong>' . drupal_render($pattern['name']) . '</strong></label>';
    $row[] = drupal_render($pattern['title']);
    $row[] = drupal_render($pattern['version']);

    // Add the description, along with any modules it requires.
    $description = drupal_render($pattern['description']);
    $row[] = array(
      'data' => $description,
      'class' => array(
        'description',
      ),
    );

    // Display links (such as help or permissions) in their own columns.
    foreach ($pattern['links'] as $key => $value) {
      $row[] = array(
        'data' => $value,
      );
    }
    $rows[] = $row;
  }
  return theme('table', array(
    'header' => $form['#header'],
    'rows' => $rows,
  ));
}