ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
Optional.php
Go to the documentation of this file.
1 <?php
2 
11 {
12  public $allow_empty = true;
13  public $type = 'optional';
14  public function validateChildren($tokens_of_children, $config, $context) {
15  $result = parent::validateChildren($tokens_of_children, $config, $context);
16  // we assume that $tokens_of_children is not modified
17  if ($result === false) {
18  if (empty($tokens_of_children)) return true;
19  elseif ($this->whitespace) return $tokens_of_children;
20  else return array();
21  }
22  return $result;
23  }
24 }
25 
26 // vim: et sw=4 sts=4
Definition that allows a set of elements, but disallows empty children.
Definition: Required.php:6
$result
Definition that allows a set of elements, and allows no children.
Definition: Optional.php:10
validateChildren($tokens_of_children, $config, $context)
Definition: Optional.php:14