function blog_form in Drupal 4
Same name and namespace in other branches
- 5 modules/blog/blog.module \blog_form()
- 6 modules/blog/blog.module \blog_form()
- 7 modules/blog/blog.module \blog_form()
Implementation of hook_form().
File
- modules/
blog.module, line 200 - Enables keeping an easily and regularly updated web page or a blog.
Code
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($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";
}
}
$form['title'] = array(
'#type' => 'textfield',
'#title' => t('Title'),
'#required' => TRUE,
'#default_value' => $node->title,
'#weight' => -5,
);
$form['body_filter']['body'] = array(
'#type' => 'textarea',
'#title' => t('Body'),
'#default_value' => $node->body,
'#rows' => 20,
'#required' => TRUE,
);
$form['body_filter']['filter'] = filter_form($node->format);
return $form;
}