extracts all dependencies to other elements from wysiwyg text
public static getDependenciesOfWysiwygText ( string $text ) : array | ||
$text | string | |
return | array |
/** * Checks if data is valid for current data field * * @param mixed $data * @param boolean $omitMandatoryCheck * @throws \Exception */ public function checkValidity($data, $omitMandatoryCheck = false) { if (!$omitMandatoryCheck and $this->getMandatory() and empty($data)) { throw new \Exception("Empty mandatory field [ " . $this->getName() . " ]"); } $dependencies = Text::getDependenciesOfWysiwygText($data); if (is_array($dependencies)) { foreach ($dependencies as $key => $value) { $el = Element\Service::getElementById($value['type'], $value['id']); if (!$el) { throw new \Exception("invalid dependency in wysiwyg text"); } } } }
/** * @return array */ public function resolveDependencies() { return Text::getDependenciesOfWysiwygText($this->text); }