You are here

function geshinode_form in GeSHi Filter for syntax highlighting 6

Same name and namespace in other branches
  1. 5.2 geshinode.module \geshinode_form()

Implementation of hook_form().

File

./geshinode.module, line 74
Implementation of a GeSHi node.

Code

function geshinode_form(&$node, $form_state) {
  require_once drupal_get_path('module', 'geshifilter') . '/geshifilter.inc';
  $type = node_get_types('type', $node);

  // set the title field
  $form['title'] = array(
    '#type' => 'textfield',
    '#title' => check_plain($type->title_label),
    '#required' => TRUE,
    '#default_value' => $node->title,
    '#weight' => -5,
  );

  // the body field
  $form['body_field'] = node_body_field($node, $type->body_label, $type->min_word_count);
  unset($form['body_field']['format']);

  // the source code language field
  $form['source_code_language'] = array(
    '#type' => 'select',
    '#title' => t('Syntax highlighting mode'),
    '#default_value' => isset($node->source_code_language) ? $node->source_code_language : variable_get('geshinode_default_language', 'php'),
    '#options' => _geshifilter_get_enabled_languages(),
    '#description' => t('Select the syntax highlighting mode to use.'),
  );
  return $form;
}