All pastes #306138 Raw Copy code Copy link Edit

Anonymous

public text v1 · immutable
#306138 ·published 2007-01-05 02:35 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'));
  }
}

// THIS IS IN node-dojo.tpl.php



<?php phptemplate_comment_wrapper(NULL, $node->type); ?>

<div id="node-<?php print $node->nid; ?>" class="node<?php if ($sticky) { print ' sticky'; } ?><?php if (!$status) { print ' node-unpublished'; } ?>">

<?php print $picture ?>

<?php if ($page == 0): ?>
  <h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
<?php endif; ?>

  <?php if ($submitted): ?>
    <span class="submitted"><?php print t('!date — !username', array('!username' => theme('username', $node), '!date' => format_date($node->created))); ?></span>
  <?php endif; ?>

  <div class="content">
<?php
echo $node->content['body']['#value'];
if ($node->field_belt_color[0]['value'] == 'white') {
echo '<h4>White Belt! Welcome To The Dojo!</h4>';
}
elseif ($node->field_belt_color[0]['value'] == 'black') {
echo '<h4>Sensei!</h4>';
}

?>


  </div>

  <div class="clear-block clear">
    <div class="meta">
    <?php if ($taxonomy): ?>
      <div class="terms"><?php print $terms ?></div>
    <?php endif;?>
    </div>

    <?php if ($links): ?>
      <div class="links"><?php print $links; ?></div>
    <?php endif; ?>
  </div>

</div>