getDependenciesOfWysiwygText() публичный статический Метод

extracts all dependencies to other elements from wysiwyg text
public static getDependenciesOfWysiwygText ( string $text ) : array
$text string
Результат array
Пример #1
0
 /**
  * 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");
             }
         }
     }
 }
Пример #2
0
 /**
  * @return array
  */
 public function resolveDependencies()
 {
     return Text::getDependenciesOfWysiwygText($this->text);
 }