drupal中body字段的最小字符数

drupal中body字段的最小字符数,drupal,drupal-6,word-count,charactercount,Drupal,Drupal 6,Word Count,Charactercount,我有一个非常困难的时间获得一个身体领域有2000个字符数,包括空格的最低限度。如果字段少于2000个字符,则不可能保存节点 到目前为止,我已经: <?php function esund_form_alter(&$form, $form_state, $form_id) { // Normally a switch is used because you may want to alter more than // one form and it is easy

我有一个非常困难的时间获得一个身体领域有2000个字符数,包括空格的最低限度。如果字段少于2000个字符,则不可能保存节点

到目前为止,我已经:

<?php

function esund_form_alter(&$form, $form_state, $form_id) {
    // Normally a switch is used because you may want to alter more than
    // one form and it is easy to add a new case for each form.
    if ($form_id == 'forslag_node_form') {
        $form['body_field']['body']['#description'] = "Description of the content of the post, which should also indicate what the motivation is to hold the post, and what problem or question topic highlights? The description must min. fill 2,000 characters incl. spaces and max. 4000.";
    }
}

function esund_menu_alter(&$items) {
    unset($items['node']);
}

我正在使用Drupal 6.31


干杯

使用以下两个钩子可以实现这一点


  • form\u alter
    中添加自定义验证,然后在
    hook\u validate
    下可以设置最小字符限制验证。

    Drupal 6内置了最小字数功能。转到节点类型编辑表单,您将看到一个选择列表。您发布的最后一段代码似乎来自不同的模块。嗨,Ayesh,我不是在寻找最小字数,而是在寻找最小字符数。此外,这些是预定义的值,我需要指定自己的值。
    <?php
    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']);
            }
    }
    ?>