_node_type_set_defaults

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

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

Версии
5 – 6
_node_type_set_defaults($info)

Устанавливает значения по умолчанию, для типа нод, определенного через hook_node_info().

▾ 5 функции вызывают _node_type_set_defaults()

default_profile_final in profiles/default/default.profile
Perform any final installation tasks for this profile.
example_profile_tasks in ./example.profile
Perform any final installation tasks for this profile.
node_type_reset in modules/node/content_types.inc
Resets all of the relevant fields of a module-defined node type to their default values.
system_update_1005 in modules/system/system.install
_node_types_build in modules/node/node.module
Builds and returns the list of available node types.

Код

<?php
function _node_type_set_defaults($info) {
  if (!isset($info['has_title'])) {
    $info['has_title'] = TRUE;
  }
  if ($info['has_title'] && !isset($info['title_label'])) {
    $info['title_label'] = t('Title');
  }

  if (!isset($info['has_body'])) {
    $info['has_body'] = TRUE;
  }
  if ($info['has_body'] && !isset($info['body_label'])) {
    $info['body_label'] = t('Body');
  }

  if (!isset($info['help'])) {
    $info['help'] = '';
  }
  if (!isset($info['min_word_count'])) {
    $info['min_word_count'] = 0;
  }
  if (!isset($info['custom'])) {
    $info['custom'] = FALSE;
  }
  if (!isset($info['modified'])) {
    $info['modified'] = FALSE;
  }
  if (!isset($info['locked'])) {
    $info['locked'] = TRUE;
  }

  $info['orig_type'] = $info['type'];
  $info['is_new'] = TRUE;

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

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