ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
Optional.php
Go to the documentation of this file.
1<?php
2
11{
15 public $allow_empty = true;
16
20 public $type = 'optional';
21
28 public function validateChildren($children, $config, $context)
29 {
30 $result = parent::validateChildren($children, $config, $context);
31 // we assume that $children is not modified
32 if ($result === false) {
33 if (empty($children)) {
34 return true;
35 } elseif ($this->whitespace) {
36 return $children;
37 } else {
38 return array();
39 }
40 }
41 return $result;
42 }
43}
44
45// vim: et sw=4 sts=4
$result
Definition that allows a set of elements, and allows no children.
Definition: Optional.php:11
validateChildren($children, $config, $context)
Definition: Optional.php:28
Definition that allows a set of elements, but disallows empty children.
Definition: Required.php:7