41 lines
844 B
PHP
Executable File
41 lines
844 B
PHP
Executable File
<?php
|
|
|
|
class ElementSet extends Element {
|
|
|
|
private static $schema;
|
|
|
|
public static function getDefinition () {
|
|
|
|
if ( self::$schema )
|
|
return static::$schema;
|
|
|
|
return static::$schema= static::getSchema(array(
|
|
'values' => self::getParams(array('default' => null, 'null' => true)),
|
|
'default' => ElementBoolean::getParams(array('default' => null, 'null' => true)),
|
|
'null' => ElementBoolean::getParams(array('default' => true, 'null' => true))
|
|
));
|
|
|
|
}
|
|
|
|
public static function getSchema ( $params = array() ) {
|
|
|
|
$params['type'] = 'set';
|
|
return $params;
|
|
|
|
}
|
|
|
|
public static function invalid ( $schema, $value, $data = array() ) {
|
|
|
|
if ( $error = parent::invalid($value, $data) )
|
|
return $error;
|
|
|
|
if ( is_null($value) || is_array($value) )
|
|
return false;
|
|
|
|
return 'Value is not a set !';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|