alleyinteractive / alleyinteractive/wordpress-fieldmanager
Impossible to perform validation on Fieldmanager_Media
- Lingua principale
- PHP
- Stelle
- 563
- Fork
- 99
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Hi there,
I am defining an image field with the Fieldmanager_Media with param validation_rules, in order to make it required.
```
/* Featured Image */
$featured_image = new Fieldmanager_Media( false, array(
'name' => 'featured_image',
'description' => 'Feature Image(16:9) min size 800x450',
'preview_size' => 'medium',
'label' => 'Featured Image',
'button_label' => 'Add Image',
'validation_rules' => array('required'=> true ),
'validation_messages' => array('required'=> 'Featured image is mandatory' ),
) );
```
This required validation rule is not running since in the code before adding the Fieldmanager validation script `hidden` fields are ignored on purpose:
```
class Fieldmanager_Util_Validation {
...
// Fields that should always be ignored
$ignore[] = ".fm-autocomplete";
$ignore[] = "input[type='button']";
$ignore[] = ":hidden";
```
Is it really necessary to include this hidden here? As far as I understand validation will only occur if validation_rules are specified. If this `hidden` is added to the `$ignore` array field of Fieldmanager_Media can't be required or have any other rules.
I am thinking of removing the ":hidden" from the `$ignore` array but would like some feedback in case you think this is compromising Fieldmanager in some way I am not currently foreseeing.
Thank you in advance.
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.