Commit d01379dd authored by Dries's avatar Dries

- Patch #522184 by stBorchert: remove the 'minimum number of words' feature from Drupal.

parent 7425d638
......@@ -129,13 +129,6 @@ function node_type_form(&$form_state, $type = NULL) {
'#default_value' => isset($type->body_label) ? $type->body_label : '',
'#description' => t('To omit the body field for this content type, remove any text and leave this field blank.'),
);
$form['submission']['min_word_count'] = array(
'#type' => 'select',
'#title' => t('Minimum number of words'),
'#default_value' => $type->min_word_count,
'#options' => drupal_map_assoc(array(0, 1, 10, 25, 50, 75, 100, 125, 150, 175, 200)),
'#description' => t('The minimum number of words for the body field to be considered valid for this content type. This can be useful to rule out submissions that do not meet the site\'s standards, such as short test posts.')
);
$form['submission']['node_preview'] = array(
'#type' => 'radios',
'#title' => t('Preview post'),
......@@ -289,7 +282,6 @@ function node_type_form_submit($form, &$form_state) {
$type->description = $form_state['values']['description'];
$type->help = $form_state['values']['help'];
$type->min_word_count = $form_state['values']['min_word_count'];
$type->title_label = $form_state['values']['title_label'];
$type->body_label = $form_state['values']['body_label'];
......
......@@ -540,8 +540,6 @@ function hook_node_build_alter($node, $build_mode) {
* field. Optional (defaults to TRUE).
* - "body_label": the label for the body field of this content type. Optional
* (defaults to 'Body').
* - "min_word_count": the minimum number of words for the body field to be
* considered valid for this content type. Optional (defaults to 0).
* - "locked": boolean indicating whether the machine-readable name of this
* content type can (FALSE) or cannot (TRUE) be edited by a site
* administrator. Optional (defaults to TRUE).
......
......@@ -299,13 +299,6 @@ function node_schema() {
'not null' => TRUE,
'default' => '',
),
'min_word_count' => array(
'description' => 'The minimum number of words the body must contain.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'size' => 'small',
),
'custom' => array(
'description' => 'A boolean indicating whether this type is defined by a module (FALSE) or by a user via a module like the Content Construction Kit (TRUE).',
'type' => 'int',
......@@ -523,6 +516,15 @@ function node_update_7005(&$context) {
return $ret;
}
/**
* Remove column min_word_count.
*/
function node_update_7006() {
$ret = array();
db_drop_field($ret, 'node_type', 'min_word_count');
return $ret;
}
/**
......
......@@ -416,7 +416,6 @@ function node_type_save($info) {
'body_label' => (string) $type->body_label,
'description' => (string) $type->description,
'help' => (string) $type->help,
'min_word_count' => (int) $type->min_word_count,
'custom' => (int) $type->custom,
'modified' => (int) $type->modified,
'locked' => (int) $type->locked,
......@@ -611,7 +610,6 @@ function node_type_set_defaults($info = array()) {
$type->base = '';
$type->description = '';
$type->help = '';
$type->min_word_count = 0;
$type->has_title = 1;
$type->has_body = 1;
$type->title_label = t('Title');
......@@ -860,13 +858,6 @@ function node_validate($node, $form = array()) {
$node = (object)$node;
$type = node_type_get_type($node);
// Make sure the body has the minimum number of words.
// TODO : use a better word counting algorithm that will work in other languages
if (!empty($type->min_word_count) && isset($node->body[0]['value']) && count(explode(' ', $node->body[0]['value'])) < $type->min_word_count) {
// TODO: Use Field API to set this error.
form_set_error('body', t('The body of your @type is too short. You need at least %words words.', array('%words' => $type->min_word_count, '@type' => $type->name)));
}
if (isset($node->nid) && (node_last_changed($node->nid) > $node->changed)) {
form_set_error('changed', t('The content on this page has either been modified by another user, or you have already submitted modifications using this form. As a result, your changes cannot be saved.'));
}
......
......@@ -750,7 +750,6 @@ protected function drupalCreateContentType($settings = array()) {
'name' => $name,
'description' => '',
'help' => '',
'min_word_count' => 0,
'title_label' => 'Title',
'body_label' => 'Body',
'has_title' => 1,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment