=== removed file 'modules/page.module' --- modules/page.module +++ /dev/null @@ -1,100 +0,0 @@ -'. t('The page module allows users to create static pages, which are the most basic type of content. Pages are commonly collected in books via the book module. Users should create a page if the information on the page is static. An example would be an "about" page. ') .'

'; - $output .= '

'. t('When a page is created, a user can set authoring information, configure publishing options, whether readers will be able to post comments. They can also select the content type of the page (e.g., full HTML, filtered HTML). ') .'

'; - $output .= '

'. t('As an administrator, you can set the publishing default for a page (in its workflow): you can specify whether a page is by default published, sent to moderation, promoted to the front page, sticky at the top of lists, and whether revisions are enabled by default. You can set the permissions that different user roles have to view, create, and edit pages.') .'

'; - $output .= '

'. t('If the location module is enabled, then location specific information can be added. If the trackback module is enabled trackbacks can be configured.') .'

'; - $output .= t('

You can

- -', array('%admin-help-node' => url('admin/help/node'), '%admin-help-page' => url('admin/help/page'), '%admin-help-story' => url('admin/help/story'), '%node-add-page' => url('node/add/page'), '%admin-settings-content-types-page' => url('admin/settings/content-types/page'))); - $output .= '

'. t('For more information please read the configuration and customization handbook Page page.', array('%page' => 'http://drupal.org/handbook/modules/page/')) .'

'; - return $output; - case 'admin/modules#description': - return t('Enables the creation of pages that can be added to the navigation system.'); - case 'node/add#page': - return t('If you want to add a static page, like a contact page or an about page, use a page.'); - } -} - -/** - * Implementation of hook_perm(). - */ -function page_perm() { - return array('create pages', 'edit own pages'); -} - -/** - * Implementation of hook_node_info(). - */ -function page_node_info() { - return array('page' => array('name' => t('page'), 'base' => 'page')); -} - -/** - * Implementation of hook_access(). - */ -function page_access($op, $node) { - global $user; - - if ($op == 'create') { - return user_access('create pages'); - } - - if ($op == 'update' || $op == 'delete') { - if (user_access('edit own pages') && ($user->uid == $node->uid)) { - return TRUE; - } - } -} - -/** - * Implementation of hook_menu(). - */ -function page_menu($may_cache) { - $items = array(); - - if ($may_cache) { - $items[] = array('path' => 'node/add/page', 'title' => t('page'), - 'access' => user_access('create pages')); - } - - return $items; -} - -/** - * Implementation of hook_form(). - */ -function page_form(&$node) { - - $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']['format'] = filter_form($node->format); - - $form['log'] = array( - '#type' => 'textarea', '#title' => t('Log message'), '#default_value' => $node->log, '#weight' => 5, - '#description' => t('An explanation of the additions or updates being made to help other authors understand your motivations.') - ); - - return $form; -} - - === removed file 'modules/story.module' --- modules/story.module +++ /dev/null @@ -1,86 +0,0 @@ -'. t('The story module is used to create a content post type called stories. Stories are articles in their simplest form: they have a title, a teaser and a body. Stories are typically used to post news articles or as a group blog. ') .'

'; - $output .= '

'. t('The story administration interface allows for complex configuration. It provides a submission form, workflow, default view permission, default edit permission, permissions for permission, and attachments. Trackbacks can also be enabled.') .'

'; - $output .= t('

You can

- -', array('%node-add-story' => url('node/add/story'), '%admin-settings-content-types-story' => url('admin/settings/content-types/story'))); - $output .= '

'. t('For more information please read the configuration and customization handbook Story page.', array('%story' => 'http://drupal.org/handbook/modules/story/')) .'

'; - return $output; - case 'admin/modules#description': - return t('Allows users to submit stories, articles or similar content.'); - case 'node/add#story': - return t('Stories are articles in their simplest form: they have a title, a teaser and a body, but can be extended by other modules. The teaser is part of the body too. Stories may be used as a personal blog or for news articles.'); - } -} - -/** - * Implementation of hook_node_info(). - */ -function story_node_info() { - return array('story' => array('name' => t('story'), 'base' => 'story')); -} - -/** - * Implementation of hook_perm(). - */ -function story_perm() { - return array('create stories', 'edit own stories'); -} - -/** - * Implementation of hook_access(). - */ -function story_access($op, $node) { - global $user; - - if ($op == 'create') { - return user_access('create stories'); - } - - if ($op == 'update' || $op == 'delete') { - if (user_access('edit own stories') && ($user->uid == $node->uid)) { - return TRUE; - } - } -} - -/** - * Implementation of hook_menu(). - */ -function story_menu($may_cache) { - $items = array(); - - if ($may_cache) { - $items[] = array('path' => 'node/add/story', 'title' => t('story'), - 'access' => user_access('create stories')); - } - - return $items; -} - -/** - * Implementation of hook_form(). - */ -function story_form(&$node) { - $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']['format'] = filter_form($node->format); - return $form; -} - === added file 'modules/content.module' --- /dev/null +++ modules/content.module @@ -0,0 +1,134 @@ +base == 'content') { + $label = check_plain($type->label); + $perms[] = "create $label content"; + $perms[] = "edit own $label content"; + $perms[] = "edit $label content"; + } + } + return $perms; +} + +/** + * Implementation of hook_menu(). + */ +function content_menu($may_cache) { + $items = array(); + $access = user_access('administer content types'); + + if ($may_cache) { + foreach (node_get_list() as $name => $label) { + $items[] = array( + 'path' => 'admin/settings/content-types/'. $name .'/delete', + 'title' => t('delete'), + 'callback' => '_content_admin_type_delete', + 'access' => $access, + 'callback arguments' => array($name), + 'type' => MENU_CALLBACK, + ); + } + } + + return $items; +} + +/** + * Implementation of hook_access(). + */ +function content_access($op, $node) { + global $user; + $type = is_string($node) ? $node : (is_array($node) ? $node['type'] : $node->type); + + if ($op == 'create') { + return user_access('create '. $type .' content'); + } + + if ($op == 'update' || $op == 'delete') { + if (user_access('edit '. $type .' content') || (user_access('edit own '. $type .' content') && ($user->uid == $node->uid))) { + return TRUE; + } + } +} + +/** + * Implementation of hook_form(). + * + * Each field defines its own component of the content entry form, via its + * chosen widget. + */ +function content_form($node) { + $type = node_get_type($node); + + if (!empty($type->title_label)) { + $form['title'] = array( + '#type' => 'textfield', + '#title' => check_plain(t($type->title_label)), + '#required' => TRUE, + '#default_value' => $node->title, + '#weight' => -5, + ); + } + + if (!empty($type->body_label)) { + $form['body_filter']['body'] = array( + '#type' => 'textarea', + '#title' => check_plain(t($type->body_label)), + '#default_value' => $node->body, + '#rows' => 20, + '#required' => TRUE); + $form['body_filter']['format'] = filter_form($node->format); + } + + + return $form; +} + +function _content_admin_type_delete($name = '') { + $type = node_get_type($name); + + $form = array(); + $form['name'] = array('#type' => 'value', '#value' => $name); + return confirm_form('_content_admin_type_delete', $form, t('Are you sure you want to delete the content type %type?', array('%type' => theme('placeholder', $type->label))), 'admin/node/types', t('If you have any content left in this content type, it will be permanently deleted. This action cannot be undone.'), t('Delete'), t('Cancel')); +} + +/** + * Delete a content type. + */ +function _content_admin_type_delete_submit($form_id, $form_values) { + $type = node_get_type($form_values['name']); + + if ($type && $form_values['confirm']) { + // Delete all nodes of this content type. + $result = db_query("SELECT nid FROM {node} WHERE type = '%s'", $form_values['name']); + while ($node = db_fetch_object($result)) { + node_delete($node->nid); + } + db_query("DELETE FROM {node_type} WHERE name = '%s'", $form_values['name']); + drupal_set_message(t('Deleted content type %type.', array('%type' => theme('placeholder', $type->label)))); + node_type_cache_clear(); + return 'admin/settings/content-types'; + } +} === modified file 'modules/node.module' --- modules/node.module +++ modules/node.module @@ -48,7 +48,8 @@ } if (arg(0) == 'node' && arg(1) == 'add' && $type = arg(2)) { - return filter_xss_admin(variable_get($type .'_help', '')); + $type = node_get_type(arg(2)); + return filter_xss_admin($type->help); } } @@ -195,16 +196,33 @@ return truncate_utf8($body, $size); } -function _node_names($op = '', $node = NULL) { - static $node_names = array(); - static $node_list = array(); - - if (empty($node_names)) { - $node_names = module_invoke_all('node_info'); - foreach ($node_names as $type => $value) { - $node_list[$type] = $value['name']; - } - } +function _node_types($op = '', $node = NULL, $reset = FALSE) { + static $node_types, $node_labels; + + $field_exists = module_exist('field'); + + if ($reset || !isset($node_types)) { + if ($field_exists && ($cached = cache_get('node_types'))) { + $node_types = unserialize($cached->data); + $cached = cache_get('node_labels'); + $node_labels = unserialize($cached->data); + } + else { + $node_types = array(); + $type_result = db_query('SELECT * FROM {node_type} nt ORDER BY nt.name ASC'); + while ($type = db_fetch_object($type_result)) { + $type->fields = module_invoke('field', 'load_type', $type->name_name); + $node_types[$type->name] = $type; + $node_labels[$type->name] = $type->label; + } + + if ($field_exists) { + cache_set('node_types', serialize($node_types), CACHE_PERMANENT); + cache_set('node_labels', serialize($node_labels), CACHE_PERMANENT); + } + } + } + if ($node) { if (is_array($node)) { $type = $node['type']; @@ -215,17 +233,21 @@ elseif (is_string($node)) { $type = $node; } - if (!isset($node_names[$type])) { + if (!isset($node_types[$type])) { return FALSE; } } switch ($op) { + case 'types': + return $node_types; + case 'type': + return $node_types[$node]; case 'base': - return $node_names[$type]['base']; + return $node_types[$type]->base; case 'list': - return $node_list; - case 'name': - return $node_list[$type]; + return $node_labels; + case 'label': + return $node_labels[$type]; } } @@ -238,7 +260,7 @@ * The basename for hook_load, hook_nodeapi etc. */ function node_get_base($node) { - return _node_names('base', $node); + return _node_types('base', $node); } /** @@ -249,8 +271,9 @@ * @return * The human readable name of the node type. */ -function node_get_name($node) { - return _node_names('name', $node); +function node_get_label($node, $check_plain = TRUE) { + $label = _node_types('label', $node); + return $check_plain ? check_plain($label) : $label; } /** @@ -259,11 +282,49 @@ * @param $node * Either a node object, a node array, or a string containing the node type. * @return - * An array consisting ('#type' => name) pairs. + * An array consisting (machine readable node name => node type object) pairs. */ function node_get_types() { - return _node_names('list'); -} + return _node_types('types'); +} + +/** + * Return a node type object. + * + * @param $node + * Either a node object, a node array, or a string containing the node type. + * @return + * A node type object. + */ +function node_get_type($node) { + return _node_types('type', $node); +} + +/** + * Return the list of available node types. + * + * @param $node + * Either a node object, a node array, or a string containing the node type. + * @return + * An array consisting (machine readable node name => human readable node name) pairs. + */ +function node_get_list() { + return _node_types('list'); +} + +/** + * Clear the cache of node_types; called in several places when content + * information is changed. + */ +function node_type_cache_clear() { + if (module_exist('field')) { + cache_clear_all('node_types'); + module_invoke('field', 'clear_type_cache'); + } + _node_types('', NULL, TRUE); + menu_rebuild(); +} + /** * Determine whether a node hook exists. @@ -726,7 +787,7 @@ $extra = node_invoke_nodeapi($node, 'search result'); $results[] = array('link' => url('node/'. $item->sid), - 'type' => node_get_name($node), + 'type' => node_get_label($node), 'title' => $node->title, 'user' => theme('username', $node), 'date' => $node->changed, @@ -850,7 +911,7 @@ 'callback' => 'node_configure', 'access' => user_access('administer nodes')); $items[] = array('path' => 'admin/settings/content-types', 'title' => t('content types'), - 'callback' => 'node_types_configure', + 'callback' => 'node_type_configure', 'access' => user_access('administer nodes')); $items[] = array('path' => 'node', 'title' => t('content'), @@ -897,7 +958,7 @@ } else if (arg(0) == 'admin' && arg(1) == 'settings' && arg(2) == 'content-types' && is_string(arg(3))) { $items[] = array('path' => 'admin/settings/content-types/'. arg(3), - 'title' => t("'%name' content type", array('%name' => node_get_name(arg(3)))), + 'title' => t("'%name' content type", array('%name' => node_get_label(arg(3)))), 'type' => MENU_CALLBACK); } } @@ -935,7 +996,7 @@ 'moderate-1' => t('in moderation'), 'moderate-0' => t('not in moderation'), 'promote-1' => t('promoted'), 'promote-0' => t('not promoted'), 'sticky-1' => t('sticky'), 'sticky-0' => t('not sticky'))); - $filters['type'] = array('title' => t('type'), 'options' => node_get_types()); + $filters['type'] = array('title' => t('type'), 'options' => node_get_list()); // The taxonomy filter if ($taxonomy = module_invoke('taxonomy', 'form_all', 1)) { $filters['category'] = array('title' => t('category'), 'options' => $taxonomy); @@ -1005,7 +1066,7 @@ foreach ($filters as $key => $filter) { $names[$key] = $filter['title']; - $form['filters']['status'][$key] = array('#type' => 'select', '#options' => $filter['options']); + $form['filters']['status'][$key] = array('#type' => 'select', '#options' => (array)$filter['options']); } $form['filters']['filter'] = array('#type' => 'radios', '#options' => $names, '#default_value' => 'status'); @@ -1150,7 +1211,7 @@ while ($node = db_fetch_object($result)) { $nodes[$node->nid] = ''; $form['title'][$node->nid] = array('#value' => l($node->title, 'node/'. $node->nid) .' '. theme('mark', node_mark($node->nid, $node->changed))); - $form['name'][$node->nid] = array('#value' => node_get_name($node)); + $form['name'][$node->nid] = array('#value' => node_get_label($node)); $form['username'][$node->nid] = array('#value' => theme('username', $node)); $form['status'][$node->nid] = array('#value' => ($node->status ? t('published') : t('not published'))); $form['operations'][$node->nid] = array('#value' => l(t('edit'), 'node/'. $node->nid .'/edit', array(), $destination)); @@ -1229,35 +1290,143 @@ /** * Menu callback; presents each node type configuration page. */ -function node_types_configure($type = NULL) { +function node_type_configure($type = NULL) { if (isset($type)) { - $node = new stdClass(); - $node->type = $type; - $form['submission'] = array('#type' => 'fieldset', '#title' =>t('Submission form') ); + $form['submission'] = array('#type' => 'fieldset', '#title' => t('Submission form'), '#collapsible' => TRUE, '#collapsed' => TRUE); $form['submission'][$type . '_help'] = array( '#type' => 'textarea', '#title' => t('Explanation or submission guidelines'), '#default_value' => variable_get($type .'_help', ''), - '#description' => t('This text will be displayed at the top of the %type submission form. It is useful for helping or instructing your users.', array('%type' => node_get_name($type))) + '#description' => t('This text will be displayed at the top of the %type submission form. It is useful for helping or instructing your users.', array('%type' => node_get_label($type))) ); $form['submission']['minimum_'. $type .'_size'] = array( '#type' => 'select', '#title' => t('Minimum number of words'), '#default_value' => variable_get('minimum_'. $type .'_size', 0), '#options' => drupal_map_assoc(array(0, 10, 25, 50, 75, 100, 125, 150, 175, 200)), - '#description' => t('The minimum number of words a %type must be to be considered valid. This can be useful to rule out submissions that do not meet the site\'s standards, such as short test posts.', array('%type' => node_get_name($type))) + '#description' => t('The minimum number of words a %type must be to be considered valid. This can be useful to rule out submissions that do not meet the site\'s standards, such as short test posts.', array('%type' => node_get_label($type))) ); - $form['workflow'] = array('#type' => 'fieldset', '#title' =>t('Workflow')); - $form['type'] = array('#type' => 'value', '#value' => $type); + $form['workflow'] = array('#type' => 'fieldset', '#title' =>t('Workflow'), '#collapsible' => TRUE, '#collapsed' => TRUE); + $form['workflow'][$type] = array('#type' => 'checkboxes', + '#title' => t('Default options'), + '#default_value' => variable_get('node_options_'. $type, array('status', 'promote')), + '#options' => array( + 'status' => t('Published'), + 'moderate' => t('In moderation queue'), + 'promote' => t('Promoted to front page'), + 'sticky' => t('Sticky at top of lists'), + 'revision' => t('Create new revision'), + ), + '#description' => t('Users with the administer nodes permission will be able to override these options.'), + ); + + + $type = node_get_type($type); + $form += _node_type_configure_form($type); + $form['texts']['#title'] = t('text'); + $form['texts']['#tree'] = TRUE; $form['array_filter'] = array('#type' => 'value', '#value' => TRUE); - return system_settings_form($type .'_node_settings', $form); + $form['buttons']['submit'] = array('#type' => 'submit', '#value' => t('Save configuration')); + $form['buttons']['reset'] = array('#type' => 'submit', '#value' => t('Reset to defaults')); + return drupal_get_form($type->name .'_node_type_configure', $form, 'node_type_configure'); } else { - $header = array(t('Type'), t('Operations')); + $header = array(t('Type'), t('Description'), array('data' => t('Operations'), 'colspan' => module_exist('fields') ? 4 : 2)); $rows = array(); - foreach (node_get_types() as $type => $name) { - $rows[] = array($name, l(t('configure'), 'admin/settings/content-types/'. $type)); - } - - return theme('table', $header, $rows); - } + + foreach (node_get_types() as $label => $type) { + $base = 'admin/settings/content-types/'. $type->name; + $row = array(); + $row[] = check_plain($type->label); + $row[] = truncate_utf8(filter_xss_admin($type->description), 60); + $row[] = l(t('configure'), $base); + if (module_exist('fields')) { + $row[] = l('fields', $base .'/fields'); + $row[] = l(t('duplicate'), $base .'/duplicate'); + } + $row[] = $type->base == 'content' ? l(t('delete'), $base .'/delete') : ' '; + $rows[] = $row; + + } + + $output = theme('table', $header, $rows); + $form = _node_type_configure_form(); + $form['texts']['#title'] = t('Add new'); + $form['texts']['submit'] = array('#type' => 'submit', '#value' => t('Add new content type')); + $output .= drupal_get_form('node_type_new', $form); + + return $output; + } +} + +function node_type_configure_submit($form_id, $form_values) { + db_query("UPDATE {node_type} SET label = '%s', description = '%s', help = '%s', title_label = '%s', body_label = '%s' WHERE name = '%s'", $form_values['texts']['label'], $form_values['texts']['description'], $form_values['texts']['help'], $form_values['texts']['title_label'], $form_values['texts']['body_label'], $form_values['texts']['type_name']); + node_type_cache_clear(); + + unset($form_values['text']); + system_settings_form_submit($form_id, $form_values); + return 'admin/settings/content-types'; +} + +function node_type_new_submit($form_id, $form_values) { + $types = node_get_types(); + $form_values['type_name'] = trim($form_values['label']); + $form_values['type_name'] = drupal_strtolower($form_values['type_name']); + $form_values['type_name'] = str_replace(array(' ', '-'), '_', $form_values['type_name']); + $form_values['type_name'] = preg_replace('/[^a-z0-9_]/', '', $form_values['type_name']); + $form_values['type_name'] = 'content-'. $form_values['type_name']; + $form_values['type_name'] = substr($form_values['type_name'], 0, 32); + if (isset($types[$form_values['type_name']])) { + $counter = 0; + do { + $new_name = substr($form_values['type_name'], 0, 30) .'_'. $counter++; + } while (isset($types[$new_name])); + $form_values['type_name'] = $new_name; + } + db_query("INSERT INTO {node_type} (base, name, label, description, help, title_label, body_label) VALUES ('content', '%s', '%s', '%s', '%s', '%s', '%s')", $form_values['type_name'], $form_values['label'], $form_values['description'], $form_values['help'], $form_values['title_label'], $form_values['body_label']); + node_type_cache_clear(); +} + +function _node_type_configure_form($type = NULL) { + if (!isset($type)) { + $type = new stdClass(); + } + $form['texts'] = array('#type' => 'fieldset', '#collapsible' => TRUE, '#collapsed' => TRUE); + $form['texts']['label'] = array( + '#title' => t('Label'), + '#type' => 'textfield', + '#default_value' => $type->label, + '#description' => t('The human-readable name of this content type.'), + '#required' => TRUE, + ); + $form['texts']['description'] = array( + '#title' => t('Description'), + '#type' => 'textarea', + '#default_value' => $type->description, + '#rows' => 10, + '#description' => t('A brief description of the content type.'), + ); + $form['texts']['help'] = array( + '#title' => t('Help text'), + '#type' => 'textarea', + '#default_value' => $type->help, + '#rows' => 10, + '#description' => t('Instructions to present to the user when adding new content of this type.'), + ); + $form['texts']['title_label'] = array( + '#title' => t('Title field label'), + '#type' => 'textfield', + '#default_value' => $type->title_label, + '#description' => t('The label for the title field.'), + ); + $form['texts']['body_label'] = array( + '#title' => t('Body field label'), + '#type' => 'textfield', + '#default_value' => $type->body_label, + '#description' => t('The label for the body field.'), + ); + $form['texts']['name'] = array( + '#type' => 'value', + '#value' => $type->name, + ); + return $form; } /** @@ -1538,7 +1707,7 @@ // Make sure the body has the minimum number of words. // todo use a better word counting algorithm that will work in other languages if (isset($node->body) && count(explode(' ', $node->body)) < variable_get('minimum_'. $node->type .'_size', 0)) { - form_set_error('body', t('The body of your %type is too short. You need at least %words words.', array('%words' => variable_get('minimum_'. $node->type .'_size', 0), '%type' => node_get_name($node)))); + form_set_error('body', t('The body of your %type is too short. You need at least %words words.', array('%words' => variable_get('minimum_'. $node->type .'_size', 0), '%type' => node_get_label($node)))); } if (isset($node->nid) && (node_last_changed($node->nid) > $node->changed)) { @@ -1732,21 +1901,23 @@ function node_add($type) { global $user; + $types = node_get_types(); // If a node type has been specified, validate its existence. - if (array_key_exists($type, node_get_types()) && node_access('create', $type)) { + if (isset($types[$type]) && node_access('create', $type)) { // Initialize settings: $node = array('uid' => $user->uid, 'name' => $user->name, 'type' => $type); $output = node_form($node); - drupal_set_title(t('Submit %name', array('%name' => node_get_name($node)))); + drupal_set_title(t('Submit %name', array('%name' => check_plain($types[$type]->label)))); } else { // If no (valid) node type has been provided, display a node type overview. - foreach (node_get_types() as $type => $name) { - if (module_invoke(node_get_base($type), 'access', 'create', $type)) { - $out = '
'. l($name, "node/add/$type", array('title' => t('Add a new %s.', array('%s' => $name)))) .'
'; - $out .= '
'. implode("\n", module_invoke_all('help', 'node/add#'. $type)) .'
'; - $item[$name] = $out; + foreach ($types as $type) { + if (module_invoke($type->base, 'access', 'create', $type->name)) { + $title = t('Add a new %s.', array('%s' => check_plain($type->label))); + $out = '
'. l($type->label, "node/add/$type->name", array('title' => $title)) .'
'; + $out .= '
'. filter_xss_admin($type->description) .'
'; + $item[$type->name] = $out; } } @@ -1803,7 +1974,7 @@ $output = theme('node_preview', $cloned_node); } drupal_set_title(t('Preview')); - drupal_set_breadcrumb(array(l(t('Home'), NULL), l(t('create content'), 'node/add'), l(t('Submit %name', array('%name' => node_get_name($node))), 'node/add/'. $node->type))); + drupal_set_breadcrumb(array(l(t('Home'), NULL), l(t('create content'), 'node/add'), l(t('Submit %name', array('%name' => node_get_label($node))), 'node/add/'. $node->type))); return $output; } @@ -1845,7 +2016,7 @@ if (node_access('update', $node)) { node_save($node); watchdog('content', t('%type: updated %title.', array('%type' => theme('placeholder', t($node->type)), '%title' => theme('placeholder', $node->title))), WATCHDOG_NOTICE, l(t('view'), 'node/'. $node->nid)); - drupal_set_message(t('The %post was updated.', array ('%post' => node_get_name($node)))); + drupal_set_message(t('The %post was updated.', array ('%post' => node_get_label($node)))); } } else { @@ -1854,7 +2025,7 @@ if (node_access('create', $node)) { node_save($node); watchdog('content', t('%type: added %title.', array('%type' => theme('placeholder', t($node->type)), '%title' => theme('placeholder', $node->title))), WATCHDOG_NOTICE, l(t('view'), "node/$node->nid")); - drupal_set_message(t('Your %post was created.', array ('%post' => node_get_name($node)))); + drupal_set_message(t('Your %post was created.', array ('%post' => node_get_label($node)))); } } if ($node->nid) { @@ -2138,24 +2309,9 @@ * Implementation of hook_form_alter(). */ function node_form_alter($form_id, &$form) { - // Node publishing options - if (isset($form['type']) && $form['type']['#value'] .'_node_settings' == $form_id) { - $form['workflow']['node_options_'. $form['type']['#value']] = array('#type' => 'checkboxes', - '#title' => t('Default options'), - '#default_value' => variable_get('node_options_'. $form['type']['#value'], array('status', 'promote')), - '#options' => array( - 'status' => t('Published'), - 'moderate' => t('In moderation queue'), - 'promote' => t('Promoted to front page'), - 'sticky' => t('Sticky at top of lists'), - 'revision' => t('Create new revision'), - ), - '#description' => t('Users with the administer nodes permission will be able to override these options.'), - ); - } // Advanced node search form - elseif ($form_id == 'search_form' && arg(1) == 'node' && user_access('use advanced search')) { + if ($form_id == 'search_form' && arg(1) == 'node' && user_access('use advanced search')) { // Keyword boxes: $form['advanced'] = array( '#type' => 'fieldset', @@ -2201,7 +2357,7 @@ } // Node types: - $types = node_get_types(); + $types = node_get_list(); $form['advanced']['type'] = array( '#type' => 'checkboxes', '#title' => t('Only of the type(s)'), === modified file 'modules/taxonomy.module' --- modules/taxonomy.module +++ modules/taxonomy.module @@ -129,7 +129,7 @@ foreach ($vocabularies as $vocabulary) { $types = array(); foreach ($vocabulary->nodes as $type) { - $node_type = node_get_name($type); + $node_type = node_get_label($type); $types[] = $node_type ? $node_type : $type; } $rows[] = array('name' => check_plain($vocabulary->name), === modified file 'modules/tracker.module' --- modules/tracker.module +++ modules/tracker.module @@ -110,7 +110,7 @@ } $rows[] = array( - node_get_name($node->type), + node_get_label($node->type), l($node->title, "node/$node->nid") .' '. theme('mark', node_mark($node->nid, $node->changed)), theme('username', $node), array('class' => 'replies', 'data' => $comments),