eZ\Publish\Core\FieldType\RichText\SearchField::extractShortText PHP Метод

extractShortText() приватный Метод

Extracts short text content of the given $document.
private extractShortText ( DOMDocument $document ) : string
$document DOMDocument
Результат string
    private function extractShortText(DOMDocument $document)
    {
        $result = null;
        if ($section = $document->documentElement->firstChild) {
            $textDom = $section->firstChild;
            if ($textDom && $textDom->hasChildNodes()) {
                $result = $textDom->firstChild->textContent;
            } elseif ($textDom) {
                $result = $textDom->textContent;
            }
        }
        if ($result === null) {
            $result = $document->documentElement->textContent;
        }
        return trim($result);
    }