Pimcore\Tool\Text::getElementsInWysiwyg PHP Метод

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

public static getElementsInWysiwyg ( $text ) : array
$text
Результат array
    public static function getElementsInWysiwyg($text)
    {
        $hash = "elements_wysiwyg_text_" . md5($text);
        if (\Zend_Registry::isRegistered($hash)) {
            return \Zend_Registry::get($hash);
        }
        $elements = [];
        $matches = self::getElementsTagsInWysiwyg($text);
        if (count($matches[2]) > 0) {
            for ($i = 0; $i < count($matches[2]); $i++) {
                preg_match("/[0-9]+/", $matches[2][$i], $idMatches);
                preg_match("/asset|object|document/", $matches[3][$i], $typeMatches);
                $id = $idMatches[0];
                $type = $typeMatches[0];
                $element = Element\Service::getElementById($type, $id);
                if ($id && $type && $element instanceof Element\ElementInterface) {
                    $elements[] = ["id" => $id, "type" => $type, "element" => $element];
                }
            }
        }
        \Zend_Registry::set($hash, $elements);
        return $elements;
    }