123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- /**
- * taken from http://www.akchauhan.com/create-drupal-form-using-theme_table-like-module-list-form/
- * following as function theme_featured_product_form($form)
- *
- * to be run as a regular function, within a module's theme function implementation
- */
- function tripal_helper_form_themeform(&$form, $field_keys){
- $rows = array();
- foreach (element_children($form) as $key) {
- $row = array();
- if (isset($form[$key]['name'])) {
-
- $status = drupal_render($form['featured'][$key]);
- $row[] = array(’data’ => $status, ‘class’ => ‘checkbox’);
-
- $bool_first = TRUE;
- foreach ($field_keys as $field_key => $value) {
- if($bool_first){
- $row[] = ‘‘. drupal_render($form[$key][$field_keys[$field_key]]) .’‘;//for "bold style"
- $bool_first = FALSE;
- }
- else{
- $row[] = array(’data’ => drupal_render($form[$key][$field_keys[$field_key]]),);
- }
- }
-
- $rows[] = $row;
- }
- }
-
- // Individual table headers.
- $header = array();
- $header[] = array(’data’ => t(’Featured’), ‘class’ => ‘checkbox’);
-
- foreach ($field_keys as $key => $value) {
- $header[] = t($key);
- }
-
- $output = theme(’table’, $header, $rows);
- $output .= drupal_render($form);
- return $output;
- }
- // function tripal_helper_form_createformdata
|