You are here

function theme_pm_attribute_list in Drupal PM (Project Management) 7

Provides HTML for the Project Management attributes list.

File

./pm.theme.inc, line 407
Provides theme functions for Project Management modules

Code

function theme_pm_attribute_list($form) {
  drupal_add_tabledrag('attributes', 'order', 'sibling', 'attribute-weight');
  $header = array();
  $row = array();
  $rows = array();
  $header = $form['form']['header']['#value'];
  unset($form['form']['header']);
  if (isset($form['form']['attributes'])) {
    foreach (element_children($form['form']['attributes']) as $key) {
      $form['form']['attributes'][$key]['attribute_weight_' . $key]['#attributes']['class'] = array(
        'attribute-weight',
      );
      $domain = check_markup($form['form']['attributes'][$key]['attribute_domain_' . $key]['#value']);
      $isdefault = $form['form']['attributes'][$key]['attribute_default_' . $key]['#default_value'];
      if ($isdefault) {
        $ischecked = 'checked="checked"';
      }
      else {
        $ischecked = '';
      }
      $domain_name = 'attribute_default_' . str_replace(' ', '|', $domain);
      $default_ctl = '<input type="radio" name="' . $domain_name . '" value="' . $key . '" ' . $ischecked . '"/>';
      $data = array(
        $domain,
        check_markup($form['form']['attributes'][$key]['attribute_akey_' . $key]['#value']),
        check_markup($form['form']['attributes'][$key]['attribute_avalue_' . $key]['#value']),
        drupal_render($form['form']['attributes'][$key]['attribute_isactive_' . $key]),
        $default_ctl,
        drupal_render($form['form']['attributes'][$key]['attribute_weight_' . $key]),
        array(
          'data' => $form['form']['attributes'][$key]['attribute_operations_' . $key]['#value'],
          'class' => 'pm_list_operations',
        ),
      );
      $row['data'] = $data;

      //      $row['class'] = empty($row['class']) ? array('draggable') : $row['class'][] = ' draggable';
      $rows[] = $row;
    }
  }
  $o = theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'id' => 'attributes',
    ),
  ));
  return $o;
}