contenttypetest.info
name = Contenttype test
description = Test - how can I create a new content type with hook form?
core = 7.x
files[] = contenttypetest.module;
files[] = contenttypetest.install;
contenttypetest.module
<?php
// hook_form implementation
function contenttypetest_form($node, &$form_state) {
$form = array();
$form['contenttypetest_pass'] = array(
'#type' => 'password',
'#title' => t('Type a password'),
'#description' => t('You can type anything you like.'),
);
$form['contenttypetest_veld'] = array(
'#type' => 'file',
'#description' => 'You might wanna upload a file!',
'#title' => 'Bestand',
);
return $form;
}
// hook_node_info() implementation
function contenttypetest_node_info() {
return array(
'contenttypetest' => array(
'name' => t('Content type test node'),
'base' => 'contenttypetest',
'module' => 'contenttypetest',
'description' => t("This nodetype is a test how to create nodetypes."),
'help' => 'So this is how your new contenttype looks!',
'title_label' => t('Test'),
'has_body' => FALSE,
),
);
}
// hook_validate() implementation
function contenttypetest_validate(){
}
?>
contenttypetest.install
<?php
// hook_uninstall() implementation
function contenttypetest_uninstall(){
node_type_delete('contenttypetest');
}
?>