node_body_field

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

modules/node/node.pages.inc, строка 262

Версии
6
node_body_field(&$node, $label, $word_count)

Return a node body field, with format and teaser.

▾ 4 функции вызывают node_body_field()

blog_form in modules/blog/blog.module
Реализация hook_form().
forum_form in modules/forum/forum.module
Реализация hook_form().
node_content_form in modules/node/node.module
Реализация hook_form().
node_example_form in developer/examples/node_example.module
Реализация hook_form().

Код

<?php
function node_body_field(&$node, $label, $word_count) {

  // Check if we need to restore the teaser at the beginning of the body.
  $include = !isset($node->teaser) || ($node->teaser == substr($node->body, 0, strlen($node->teaser)));

  $form = array(
    '#after_build' => array('node_teaser_js', 'node_teaser_include_verify'));

  $form['#prefix'] = '<div class="body-field-wrapper">';
  $form['#suffix'] = '</div>';

  $form['teaser_js'] = array(
    '#type' => 'textarea',
    '#rows' => 10,
    '#teaser' => 'edit-body',
    '#teaser_checkbox' => 'edit-teaser-include',
    '#disabled' => TRUE,
  );

  $form['teaser_include'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show summary in full view'),
    '#default_value' => $include,
    '#prefix' => '<div class="teaser-checkbox">',
    '#suffix' => '</div>',
  );

  $form['body'] = array(
    '#type' => 'textarea',
    '#title' => check_plain($label),
    '#default_value' => $include ? $node->body : ($node->teaser . $node->body),
    '#rows' => 20,
    '#required' => ($word_count > 0),
  );

  $form['format'] = filter_form($node->format);

  return $form;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему