blog_form

Versions
4.6 – 6
blog_form(&$node)
7
blog_form($node, $form_state)

Implementation of hook_form().

Code

modules/blog.module, line 187

<?php
function blog_form(&$node) {
  global $nid;
  $iid = $_GET['iid'];

  if (empty($node->body)) {
    /*
    ** If the user clicked a "blog it" link, we load the data from the
    ** database and quote it in the blog:
    */

    if ($nid && $blog = node_load(array('nid' => $nid))) {
      $node->body = '<em>'. $blog->body .'</em> ['. l($blog->name, "node/$nid") .']';
    }

    if ($iid && $item = db_fetch_object(db_query('SELECT i.*, f.title as ftitle, f.link as flink FROM {aggregator_item} i, {aggregator_feed} f WHERE i.iid = %d AND i.fid = f.fid', $iid))) {
      $node->title = $item->title;
      // Note: $item->description has been validated on aggregation.
      $node->body = '<a href="'. check_url($item->link) .'">'. check_plain($item->title) .'</a> - <em>'. $item->description .'</em> [<a href="'. check_url($item->flink) .'">'. check_plain($item->ftitle) ."</a>]\n";
    }
  }

  if (function_exists('taxonomy_node_form')) {
    $output .= implode('', taxonomy_node_form('blog', $node));
  }

  $output .= form_textarea(t('Body'), 'body', $node->body, 60, 20, '', NULL, TRUE);
  $output .= filter_form('format', $node->format);

  return $output;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.