node_submit

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

modules/node/node.module, строка 814

Версии
5 – 6
node_submit($node)

Подготавливает ноду к записи и делает возможным вносить изменния другими модулями.

▾ 3 функции вызывают node_submit()

blogapi_blogger_edit_post in modules/blogapi/blogapi.module
Коллбэк Blogging API. Модифицирует указанную ноду блога.
blogapi_blogger_new_post in modules/blogapi/blogapi.module
Коллбэк Blogging API. Вставляет новую запись блога как ноду.
node_form_submit_build_node in modules/node/node.pages.inc
Build a node by processing submitted form values and prepare for a form rebuild.

Код

<?php
function node_submit($node) {
  global $user;

  // Convert the node to an object, if necessary.
  $node = (object)$node;

  // Generate the teaser, but only if it hasn't been set (e.g. by a
  // module-provided 'teaser' form item).
  if (!isset($node->teaser)) {
    if (isset($node->body)) {
      $node->teaser = node_teaser($node->body, isset($node->format) ? $node->format : NULL);
      // Chop off the teaser from the body if needed. The teaser_include
      // property might not be set (eg. in Blog API postings), so only act on
      // it, if it was set with a given value.
      if (isset($node->teaser_include) && !$node->teaser_include && $node->teaser == substr($node->body, 0, strlen($node->teaser))) {
        $node->body = substr($node->body, strlen($node->teaser));
      }
    }
    else {
      $node->teaser = '';
      $node->format = 0;
    }
  }

  if (user_access('administer nodes')) {
    // Populate the "authored by" field.
    if ($account = user_load(array('name' => $node->name))) {
      $node->uid = $account->uid;
    }
    else {
      $node->uid = 0;
    }
  }
  $node->created = !empty($node->date) ? strtotime($node->date) : time();
  $node->validated = TRUE;

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

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