Custom form template So I am recently started working on front-end development, and have started messing around with making my own custom templates for modules. I have been able to get page related templates to work, but am having a problem getting form related templates to work. 

This is for Drupal 7.

I have a form, like this (Its not quite this basic, but very similar and no special fields)

function mymodule_menu() {
  $items['admin/atavism/config'] = array(
    'title' =&gt; 'Configuration',
    'page callback' =&gt; 'drupal_get_form',
    'page arguments' =&gt; array('atavism_config'),
    'access arguments' =&gt; TRUE,
  );
}

function atavism_config() {
  $form['submit'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; 'Save Configuration',
  );

  $form = theme('atavism_config_form', array('form',$form));
  return $form;
}

function atavism_theme() {
  return array(
    'atavism_config_form' =&gt; array(
      'template' =&gt; 'page--atavism-config-form',
      'path' =&gt; drupal_get_path('module','atavism') . '/theme',
    ),
  );
}


And then I created the page--atavism-config-form.tpl.php. Inside of the form, I am using;

print render($form); 


I am doing the same thing for pages that are just content (normal pages with just text and markup for example, and no forms), and it's working as intended, but I am also doing the same thing for a couple of different forms I have, and I am running into two problems. Either #1, the form renders in the template, but ONLY the provided $form variables are available (so the form can't be submitted), or I get a white screen with a PHP error of 'Unsupported operand'.

It appears I may be doing something wrong with forms, but I can't figure out what. Could somebody please help me?
Adding the response I gave on Drupal.org:

The issue is that you are rendering the form with the theme() function, in the form definition. Instead, you need to identify the form as using a #theme, and let it be rendered downstream:

So remove this:

$form = theme('atavism_license_list_view', array('form' =&gt; $form));


And add this:

$form['#theme'] = 'atavism_license_list_view';


Link: https://www.drupal.org/forum/support/module-development-and-code-questions/2019-03-07/custom-template-file-for-modules#comment-13019068