Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
It may happen that you want to add a minimum word limit for a content type, but you don't want one of the default pre-entered settings. This mini-module changes it to a textbox, where you can enter any number you like.
The .module:
function minimum_words_text_form_alter(&$form, $form_state, $form_id) {
if ($form['#parameters'][0] == 'node_type_form') {
$form['submission']['min_word_count']['#type'] = 'textfield';
unset($form['submission']['min_word_count']['#options']);
}
}
The .info file:
name = Minimum words as text field
description = Makes the minimum word count of a content type a text field.
core = 6.x
Comments
Seems not to work
I added the module and activated it in Drupal 6.13.
But there is now change in the Content Type form - I still only get the drop down box with 200 words.
I would like to increase the Min. word count for certain content types to make users write articles properly and not just collect points on a 200 word copy.
Thanks for any suggestions ....
This does work with current Drupal versions.
Just to clarify for anyone who stumbles on here. The function above is specific to the name used for the module. I named my test module "minimum_words", I needed to set the function name to minimum_words_form_alter (note the non-existence of "text" in the name)....
I'm hoping I get used to the Drupal API sooner or later.