function hook_form


Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/
cis7 node.api.php hook_form($node, &$form_state)
cle7 node.api.php hook_form($node, &$form_state)
elmsmedia7 node.api.php hook_form($node, &$form_state)
icor7 node.api.php hook_form($node, &$form_state)
meedjum_blog7 node.api.php hook_form($node, &$form_state)
mooc7 node.api.php hook_form($node, &$form_state)

Display a node editing form.

This hook, implemented by node modules, is called to retrieve the form that is displayed to create or edit a node. This form is displayed at path node/add/[node type] or node/[node ID]/edit.

The submit and preview buttons, administrative and display controls, and sections added by other modules (such as path settings, menu settings, comment settings, and fields managed by the Field UI module) are displayed automatically by the node module. This hook just needs to return the node title and form editing fields specific to the node type.


$node: The node being added or edited.

$form_state: The form state array.

Return value

An array containing the title and any custom form elements to be displayed in the node editing form.

Related topics

1001 functions implement hook_form()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

accessibility_admin_filter_form in sites/all/modules/ulmus/accessibility/
Form to filter accessibility tests.
accessibility_content_admin_form in sites/all/modules/ulmus/accessibility/modules/accessibility_content/
accessibility_handler_link_field::options_form in sites/all/modules/ulmus/accessibility/views/
accessibility_testswarm_admin_form in sites/all/modules/ulmus/accessibility/modules/accessibility_testswarm/
Admin form for users to define paths for automated accessibility testing.
accessibility_test_add_form in sites/all/modules/ulmus/accessibility/accessibility.module
Form for saving accessibiliy test entities.

... See full list

1 invocation of hook_form()
field_attach_form in modules/field/
Add form elements for all fields for an entity to a form structure.


modules/node/node.api.php, line 1107
Hooks provided by the Node module.


function hook_form($node, &$form_state) {
  $type = node_type_get_type($node);

  $form['title'] = array(
    '#type' => 'textfield',
    '#title' => check_plain($type->title_label),
    '#default_value' => !empty($node->title) ? $node->title : '',
    '#required' => TRUE,
    '#weight' => -5,

  $form['field1'] = array(
    '#type' => 'textfield',
    '#title' => t('Custom field'),
    '#default_value' => $node->field1,
    '#maxlength' => 127,
  $form['selectbox'] = array(
    '#type' => 'select',
    '#title' => t('Select box'),
    '#default_value' => $node->selectbox,
    '#options' => array(
      1 => 'Option A',
      2 => 'Option B',
      3 => 'Option C',
    '#description' => t('Choose an option.'),

  return $form;



Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/ in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/
The website encountered an unexpected error. Please try again later.