protected function validate_after_order() {
        $nodearray = $this->nodes;
        foreach ($this->nodes as $node) {
            $after = $node->after;
            if (!empty($after)) {
                if (empty($nodearray[$after])) {
                    throw new \coding_exception('node {$node->name} specified contains invalid \'after\' property');
                } else {
                    // Valid node found.
                    $afternode = $nodearray[$after];
                    $beforecontent = $node->content;
                    $aftercontent = $afternode->content;

                    if ((empty($beforecontent) && !empty($aftercontent)) || (!empty($beforecontent) && empty($aftercontent))) {
                        // Only node with content are allowed after content nodes. Same goes for no content nodes.
                        throw new \coding_exception('node {$node->name} specified contains invalid \'after\' property');
                    }
                }
            }
        }
    }