Where do I set the HTML that wraps a module's config $form inputs? I am transferring a module from one site to another. All is well except the modules form (where I set settings, upload images, etc). On the original site this is nicely wrapped in a table with each section being a row, but on my new site the form elements are just placed in one after the other, appearing vertically. This is despite me copying the modules .inc, .tpl and .module files almost verbatim. 

I'm new to Drupal in general so am struggling with this a bit. Would anyone know where this is set (what file, what function)?

function gallery_grid_theme($existing, $type, $theme, $path) {
  $items = array();

  $items['gallery_grid'] = array(
    'render element' =&gt; 'element',
    'path' =&gt; drupal_get_path('module', 'gallery_grid') . '/plugins/content_types/gallery_grid/templates',
    'template' =&gt; 'gallery-grid',
    'variables' =&gt; [],
  );

  // Draggable table for gallery-grid admin form.
  $items['gallery_grid_draggable_form'] = array(
    'render element' =&gt; 'fieldset',
    'file' =&gt; drupal_get_path('module', 'gallery_grid') . '/plugins/content_types/gallery_grid/gallery_grid.theme.inc',
  );

  return $items;
}


Contents of gallery_grid.theme.inc:

function theme_gallery_grid_draggable_form($variables) {
  $fieldset = $variables['fieldset'];
  $rows = array();

  // Table for the items.
  foreach (element_children($fieldset) as $key) {
    $fieldset[$key]['weight']['#attributes']['class'] = array('item-weight');
    $rows[] = array(
      'data' =&gt; array(
        render($fieldset[$key]['image_file']),
        render($fieldset[$key]['image_url']) . render($fieldset[$key]['image_title']),
        render($fieldset[$key]['delete_row']),
        render($fieldset[$key]['weight']),
      ),
      'class' =&gt; array('draggable'),
    );
  }

  // Header and render.
  $header = array(t('Image *'), t('Image Settings'), t('Actions'), t('Weight'));
  $table_id = 'items-table';
  $output = theme('table', array(
    'header' =&gt; $header,
    'rows' =&gt; $rows,
    'attributes' =&gt; array('id' =&gt; $table_id),
    'sticky' =&gt; FALSE,
  ));

  // Add tabledrag.
  drupal_add_tabledrag($table_id, 'order', 'sibling', 'item-weight');
  return $output;
}
Did you look at form templates? The steps change a little if you are using a starter theme, but the basics are the same. 

http://themery.com/dgd7/advanced-theming/forms/with-templates