All pastes #306122 Raw Copy code Copy link Edit

Untitled

public text v1 · immutable
#306122 ·published 2007-01-05 02:16 UTC
rendered paste body
<?php
function dojo_form_alter($form_id, &$form) {
  if ($form_id == 'page_node_form') {
    $form['#theme'] = 'dojo';
    $form['#validate']['dojo_validate'] = array();
  }
}

function theme_dojo($form) {
  $output = drupal_render($form['title']);
  $output .= drupal_render($form['body_filter']);
  $output .= '<h1>I added this in the middle of the form</h1>';
  $output .= drupal_render($form);
  return $output;
}

function dojo_validate($form_id, $form_values, $form) {
  if ($form_values['title'] == 'Foo') {
    form_set_error('title', t('Foo is not allowed'));
  }
}