21 $string = trim($string);
26 $parent_result = parent::validate($string,
$config, $context);
27 if ($parent_result !==
false) {
28 return $parent_result;
31 $length = strlen($string);
32 $last_char = $string[$length - 1];
34 if ($last_char !==
'%') {
38 $points = substr($string, 0, $length - 1);
40 if (!is_numeric($points)) {
44 $points = (int)$points;
52 return ((
string)$points) .
'%';
Validates an integer representation of pixels according to the HTML spec.
Validates the HTML type length (not to be confused with CSS's length).
validate($string, $config, $context)