- First commit to issue fork.
I needed a Node Body Validator
I cloned Node Title Validation
1.changed all occurrences from title to body (almost all)
2. changed
//if (mb_strlen($value_body) < $config_value) {
if (_rip_tags($value_body) < $config_value) {
and
//if (mb_strlen($value_body) > $config_value) {
if (_rip_tags($value_body) > $config_value) {
added _rip_tags function at the end of NodeBodyConstraintValidator.php
3. changes in NodeTitleValidationAdminForm.php
$form[$type->get('type')]['min-' . $type->get('type')] = [
'#type' => 'number',
'#title' => $this->t("Minimum characters"),
'#required' => TRUE,
'#description' => $this->t("Minimum number of characters node body should contain"),
'#max' => 9999,
'#min' => 1,
'#default_value' => isset($node_body_validation_config['min-' . $type->get('type')]) ? $node_body_validation_config['min-' . $type->get('type')] : 1,
];
$form[$type->get('type')]['max-' . $type->get('type')] = [
'#type' => 'number',
'#title' => $this->t("Maximum characters"),
'#required' => TRUE,
'#description' => $this->t("Maximum number of characters node body should contain"),
'#max' => 9999,
'#min' => 1,
'#default_value' => isset($node_body_validation_config['max-' . $type->get('type')]) ? $node_body_validation_config['max-' . $type->get('type')] : 9999,
];
$form[$type->get('type')]['min-wc-' . $type->get('type')] = [
'#type' => 'number',
'#title' => $this->t("Minimum Word Count"),
'#required' => TRUE,
'#description' => $this->t("Minimum number of words node body should contain"),
'#max' => 4999,
'#min' => 1,
'#default_value' => isset($node_body_validation_config['min-wc-' . $type->get('type')]) ? $node_body_validation_config['min-wc-' . $type->get('type')] : 1,
];
$form[$type->get('type')]['max-wc-' . $type->get('type')] = [
'#type' => 'number',
'#title' => $this->t("Maximum Word Count"),
'#description' => $this->t("Maximum number of words node body should contain"),
'#max' => 4999,
'#min' => 1,
'#default_value' => isset($node_body_validation_config['max-wc-' . $type->get('type')]) ? $node_body_validation_config['max-wc-' . $type->get('type')] : 4999,
];
Maybe you guys want to make a sister module : Node Body Validator.
Make the Node Body Validator module.
--
I hope this helps somebody.
Active
1.22
Miscellaneous
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.