bshaffer / csSettingsPlugin

Add simple user-editable settings to your application
http://www.symfony-project.org/plugins/csSettingsPlugin
MIT License
12 stars 6 forks source link

Adding validator options #5

Open roldan opened 13 years ago

roldan commented 13 years ago

There is no way to set validator options in the backend. however, there is a way to do it in > the code. Lets say you have a setting called "config_path" that you want to validate in a certain way. In /path/to/project/lib/form/doctrine/csSettingsPlugin/csSettingForm.class.php > you can declare a public method like this:

 public function getConfigPathSettingValidator()
 {
     return new sfValidatorString(array('max_length' => 100, 'required' => true'));
 }

Or whatever validation you would like. This allows you to customize validation for certain > > settings."

Is that helpful?

Yes, it is good that way but I served in this case. I have type settings "upload"and I need to define "mime_types" and "validated_file_class" different options for each setting. I think I'll add one more field to the model: "validator_options"

roldan commented 13 years ago

I just realized that the solution you proposed walk. The issue is that I would be very useful to edit validator options from the backend ...

bshaffer commented 13 years ago

You're right, I will look into possibly adding a "validator options" textbox.

I'll try to get around to this. Pull requests welcome!