Please could someone advise what is wrong with the following? When the page loads it downloads an unknown file type. The form is displayed but not with the template/theming.
The form...
function test_form($form, &$form_submit) {
$form['message'] = array(
'#type' => 'textarea',
'#title' => t('Message'),
'#required' => TRUE,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Send')
);
// Get the path to the module
$path = drupal_get_path('module', 'test');
// Attach the CSS and JS to the form
$form['#attached'] = array
(
'css' => array
(
'type' => 'file',
'data' => $path . '/css/test.css',
),
'js' => array
(
'type' => 'file',
'data' => $path . '/js/test.js',
),
);
$form['#theme'] = 'test_form';
return $form;
}
The theme...
function test_theme($existing, $type, $theme, $path) {
return array(
'test_form' => array(
//'arguments' => array('form' => null),
'path' => drupal_get_path('module', 'test') . '/templates',
'template' => 'test',
'render element' => 'form',
),
);
}
The directory...
- test
- test/css/test.css
- test/js/test.js
- test/templates/test.tpl.php
- test/test.info test/test.module