function render() { // Validate defaultParam's value. $def = $this->getDefaultParam(); if (!empty($def)) { if (!$this->props->defines($def)) { throw new ComponentException($this, "Invalid value for <kbd>defaultParam</kbd> on <b><{$this->props->macro}></b>; parameter <kbd>{$def}</kbd> does not exist"); } // Move children to default parameter. if ($this->hasChildren()) { $type = $this->props->getTypeOf($def); if ($type != type::content && $type != type::metadata) { throw new ComponentException($this, sprintf("The macro's default parameter <kbd>{$def}</kbd> can't hold content because its type is <kbd>%s</kbd>.", type::getNameOf($type))); } $param = new Metadata($this->context, ucfirst($def), $type); $this->props->set($def, $param); $param->attachTo($this); $param->setChildren($this->getChildren()); } } elseif ($this->hasChildren()) { throw new ComponentException($this, 'You may not specify content for this tag because it has no default property'); } parent::render(); }