|
Revision 9048, 1.3 kB
(checked in by FabianLange, 5 years ago)
|
1.1: fixed @param phpdoc to fit specs in validator (refs #2991)
|
- Property svn:mime-type set to
text/x-php
- Property svn:eol-style set to
native
- Property svn:keywords set to
Id
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
class sfValidatorCallback extends sfValidatorBase |
|---|
| 20 |
{ |
|---|
| 21 |
|
|---|
| 22 |
* Configures the current validator. |
|---|
| 23 |
* |
|---|
| 24 |
* Available options: |
|---|
| 25 |
* |
|---|
| 26 |
* * callback: A valid PHP callback (required) |
|---|
| 27 |
* * arguments: An array of arguments to pass to the callback |
|---|
| 28 |
* |
|---|
| 29 |
* @param array $options An array of options |
|---|
| 30 |
* @param array $messages An array of error messages |
|---|
| 31 |
* |
|---|
| 32 |
* @see sfValidatorBase |
|---|
| 33 |
*/ |
|---|
| 34 |
protected function configure($options = array(), $messages = array()) |
|---|
| 35 |
{ |
|---|
| 36 |
$this->addRequiredOption('callback'); |
|---|
| 37 |
$this->addOption('arguments', array()); |
|---|
| 38 |
|
|---|
| 39 |
$this->setOption('required', false); |
|---|
| 40 |
} |
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
* @see sfValidatorBase |
|---|
| 44 |
*/ |
|---|
| 45 |
protected function doClean($value) |
|---|
| 46 |
{ |
|---|
| 47 |
return call_user_func($this->getOption('callback'), $this, $value, $this->getOption('arguments')); |
|---|
| 48 |
} |
|---|
| 49 |
} |
|---|
| 50 |
|
|---|