19 declare(strict_types=1);
61 return $this->element_factory->set(
71 if (!$this->data_validator->isValid($root,
true)) {
72 throw new \ilMDRepositoryException(
'Invalid data on root');
74 return $this->element_factory->root(
75 $root->getDefinition(),
76 ...$this->getCleanSubElements($root, 0)
88 throw new \ilMDStructureException(
'LOM Structure is nested to deep.');
92 $name = $sub->getDefinition()->name();
93 if ($sub->isScaffold()) {
96 if ($sub->getDefinition()->unique() && in_array($name, $sub_names)) {
100 if ($this->data_validator->isValid($sub,
true)) {
101 $sub_names[] = $name;
102 yield $this->element_factory->element(
104 $sub->getDefinition(),
105 $sub->getData()->value(),
106 ...$this->getCleanSubElements($sub, $depth + 1)
110 $message = $sub->getData()->value() .
' is not valid as ' .
111 $sub->getData()->type()->value .
' data.';
126 throw new \ilMDStructureException(
'LOM Structure is nested to deep.');
133 $marker->action() === Action::CREATE_OR_UPDATE &&
134 !$this->data_validator->isValid($element,
false)
136 $message = $marker->dataValue() .
' is not valid as ' .
140 foreach ($this->dictionary->tagsForElement($element) as $tag) {
154 case Restriction::PRESET_VALUE:
161 'can only be created with preset value ' . $tag->
value(),
167 case Restriction::NOT_DELETABLE:
175 $marker->
action() === Action::CREATE_OR_UPDATE &&
176 $element->
getMDID() !== NoID::SCAFFOLD
188 return $element->
getMDID() === NoID::SCAFFOLD && (
189 $marker->
action() === Action::CREATE_OR_UPDATE ||
190 $marker->
action() === Action::NEUTRAL
197 bool $throw_error =
false 203 $message = $super->getDefinition()->name() .
': ' .
$message;
206 throw new \ilMDRepositoryException(
'Invalid marker on element ' . $message);
208 $this->
logger->info(
'Skipping element ' . $message);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins