You are here

function theme_galleria_form_table in Galleria 7

Theme to embed tables into forms.

2 theme calls to theme_galleria_form_table()
galleria_form_optionset_edit in includes/galleria.admin.inc
Form builder; Form to edit a given option set.
galleria_form_settings in includes/galleria.admin.inc
Form builder; Form for advanced module settings.

File

includes/galleria.admin.inc, line 98
Administrative page callbacks for the galleria module.

Code

function theme_galleria_form_table($variables) {
  $form = $variables['form'];
  $rows = array();
  foreach (element_children($form) as $row_key) {
    $row = array();
    foreach (element_get_visible_children($form[$row_key]) as $cell_key) {
      $cell = array(
        'data' => drupal_render($form[$row_key][$cell_key]),
      );
      if (!empty($form[$row_key][$cell_key]['#table_attributes'])) {
        $cell += $form[$row_key][$cell_key]['#table_attributes'];
      }
      $row[] = $cell;
    }
    $rows[] = $row;
  }
  $variables = array();
  foreach ($form as $key => $value) {
    if (element_property($key)) {
      $variables[substr($key, 1)] = $value;
    }
  }
  $variables['rows'] = $rows;
  return theme('table', $variables);
}