| Versionen | |
|---|---|
| drupal6 – drupal7 | node_teaser_js(&$form, &$form_state) |
See if the user used JS to submit a teaser.
modules/
<?php
function node_teaser_js(&$form, &$form_state) {
if (isset($form['#post']['teaser_js'])) {
// Glue the teaser to the body.
if (trim($form_state['values']['teaser_js'])) {
// Space the teaser from the body
$body = trim($form_state['values']['teaser_js']) . "\r\n<!--break-->\r\n" . trim($form_state['values']['body']);
}
else {
// Empty teaser, no spaces.
$body = '<!--break-->' . $form_state['values']['body'];
}
// Pass updated body value on to preview/submit form processing.
form_set_value($form['body'], $body, $form_state);
// Pass updated body value back onto form for those cases
// in which the form is redisplayed.
$form['body']['#value'] = $body;
}
return $form;
}
?>
Kommentare
Kommentar hinzufügen