code/SEO_Metadata_SiteTree_DataExtension.php
public function GenerateDescriptionFromContent()
    {
        // check for content
        if ($content = trim($this->owner->Content)) {
            // pillage first paragraph from page content
            if (preg_match('/<p>(.*?)<\/p>/i', $content, $match)) {
                // is HTML
                $content = $match[0];
            } else {
                // is plain text
                $content = explode(PHP_EOL, $content);
                $content = $content[0];
            }
            // decode (no harm done) & return
            return trim(html_entity_decode(strip_tags($content)));
        } else {
            return null;
        }
    }
public function GenerateDescriptionFromContent()
    {
        // check for content
        if ($content = trim($this->owner->Content)) {
            // pillage first paragraph from page content
            if (preg_match('/<p>(.*?)<\/p>/i', $content, $match)) {
                // is HTML
                $content = $match[0];
            } else {
                // is plain text
                $content = explode(PHP_EOL, $content);
                $content = $content[0];
            }
            // decode (no harm done) & return
            return trim(html_entity_decode(strip_tags($content)));
        } else {
            return null;
        }
    }
public function GenerateDescriptionFromContent ( ) { // check for content if ( $ content = trim ( $ this -> owner -> Content ) ) { // pillage first paragraph from page content if ( preg_match ( '/<p>(.*?)<\/p>/i' , $ content , $ match ) ) { // is HTML $ content = $ match [ 0 ] ; } else { // is plain text $ content = explode ( PHP_EOL , $ content ) ; $ content = $ content [ 0 ] ; } // decode (no harm done) & return return trim ( html_entity_decode ( strip_tags ( $ content ) ) ) ; } else { return null ; } }
Generates description from the first paragraph of the `Content` attribute.

@return string|null
Generates description from the first paragraph of the Content attribute .