function theme_chado_add_node_form_properties

2.x tripal_core.chado_nodes.properties.api.inc theme_chado_add_node_form_properties($variables)
3.x tripal_core.chado_nodes.properties.api.inc theme_chado_add_node_form_properties($variables)

Function to theme the add/remove properties form into a table

Related topics

1 string reference to 'theme_chado_add_node_form_properties'
tripal_core_theme in tripal_core/tripal_core.module
Implements hook_theme(). Registers template files/functions used by this module.

File

tripal_core/api/tripal_core.chado_nodes.properties.api.inc, line 793
API to manage the chado prop table for various Tripal Node Types

Code

function theme_chado_add_node_form_properties($variables) {
  $element = $variables['element'];

  $header = array(
    'type' => array('data' => t('Type'), 'width' => '30%'),
    'value' => array('data' => t('Value'), 'width' => '50%'),
    'property_action' => array('data' => t('Actions'), 'width' => '20%'),
  );

  $rows = array();
  foreach (element_children($element) as $type_id) {
    if ($type_id == 'new') {
      $row = array();

      $row['data'] = array();
      foreach ($header as $fieldname => $title) {
        $row['data'][] = drupal_render($element[$type_id][$fieldname]);
      }
      $rows[] = $row;
    }
    else {
      foreach (element_children($element[$type_id]) as $version) {
        $row = array();

        $row['data'] = array();
        $row['class'] = $element[$type_id][$version]['#attributes']['class'];
        foreach ($header as $fieldname => $title) {
          $row['data'][] = drupal_render($element[$type_id][$version][$fieldname]);
        }
        $rows[] = $row;
      }
    }
  }

  return render($element['save_warning']) . theme('table', array(
    'header' => $header,
    'rows' => $rows
  ));
}