Mercurial > hg > cmmr2012-drupal-site
view vendor/chi-teck/drupal-code-generator/templates/d7/hook/form.twig @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | c75dbcec494b |
children |
line wrap: on
line source
/** * Implements hook_form(). */ function {{ machine_name }}_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; }