Determine the headline to use.

@return string.
337219
protected function getHeadline()
    {
        $definitionName = $this->getDataDefinition()->getName();
        $translator     = $this->getEnvironment()->getTranslator();

        if ($this->model->getId()) {
            $headline = $translator->translate('editRecord', $definitionName, [$this->model->getId()]);

            if ('editRecord' !== $headline) {
                return $headline;
            }
            return $translator->translate('MSC.editRecord', null, [$this->model->getId()]);
        }

        $headline = $translator->translate('newRecord', $definitionName, [$this->model->getId()]);
        if ('newRecord' !== $headline) {
            return $headline;
        }

        return $translator->translate('MSC.editRecord', null, ['']);
    }
469576
public function getTitle()
    {
        $iLang = \OxidEsales\Eshop\Core\Registry::getLang()->getTplLanguage();

        return $this->getInfo("title", $iLang);
    }
406118
public function getDescription()
    {
        return vsprintf(
            'The value is expected to be between %f and %f'
            . ' (%f <= x <= %f).',
            [$this->min, $this->max, $this->min, $this->max]
        );
    }
59223
public function getHeadingText()
    {
        if ($this->Heading) {
            return $this->Heading;
        }
        
        if ($this->hasLinkPage()) {
            return $this->LinkPage()->MetaTitle;
        }
    }
760353
protected function getTitleTag()
    {
        $legend_tag = new SwatHtmlTag('legend');
        $legend_tag->setContent($this->title, $this->title_content_type);

        return $legend_tag;
    }
262509
private function getFormattedText(): string {
        $this->removeNodesWithNegativeScores($this->article()->getTopNode());
        $this->convertLinksToText($this->article()->getTopNode());
        $this->replaceTagsWithText($this->article()->getTopNode());
        $this->removeParagraphsWithFewWords($this->article()->getTopNode());

        return $this->convertToText($this->article()->getTopNode());
    }
960962
public function getLinkedTitleAttribute()
    {
        if (!$this->title) return;
        return sprintf('<a href="%s">"%s"</a>',
            $this->filterUrl(['model' => $this->model, 'key' => $this->key]),
            $this->title);
    }
885661
private function getAbout()
    {
        $html = $this->_parser->find('#content table tr', 0)->find('td', 0)->next_sibling();

        preg_match('/(<div class="normal_header" style="height: 15px;">).*(<div class="normal_header">)/', $html, $about);

        $html = $html->find('div[class=normal_header]', 0);
        $about = str_replace($html->outertext, '', $about[0]);
        $about = str_replace('<div class="normal_header">', '', $about);

        preg_match('/(No biography written)/', $about, $temp_about);
        if (!$temp_about) {
            $about = str_replace(['<br>', '<br />', '  '], ["\n", "\n", ' '], $about);
            $about = strip_tags($about);

            return preg_replace('/\n[^\S\n]*/', "\n", $about);
        } else {
            return;
        }
    }
1041260
public function getHeaderText(): string
    {
        $header      = $this->getHeaderElement();
        $header_text = $header->getText();
        $header_link = $header->find('css', 'a');

        // The page headers can often include an 'add new link'. Strip that out of the header text.
        if ($header_link) {
            $header_text = trim(str_replace($header_link->getText(), '', $header_text));
        }

        return $header_text;
    }
82894
public function getTitle()
    {
        $f = $this->hasField($this->title_field);

        return $f ? $f->get() : $this->id;
    }
1002309
public function determine_format() {
        return new text_attribute(
            $this->get_name(),
            $this->get_value(),
            $this->get_label(),
            $this->is_disabled()
        );
    }
28453
public function getTitle()
    {
        if ($this->_sCatTitle === null) {
            $this->_sCatTitle = '';
            if ($oVendor = $this->getActVendor()) {
                $this->_sCatTitle = $oVendor->oxvendor__oxtitle->value;
            }
        }

        return $this->_sCatTitle;
    }
1026770
public function getTitleText()
    {
        if ($this->UseSourceTitle && $this->hasSourceComponent()) {
            return $this->SourceComponent()->getTitleText();
        }
        
        return parent::getTitleText();
    }
11274
protected function parseTitle() {
    if (is_object($this->file)) {
      if (isset($this->file->title)) {
        return $this->file->title;
      }
    }

    if (is_array($this->file)) {
      if (isset($this->file['title'])) {
        return $this->file['title'];
      }
    }

    return '';
  }
924920
public function documentTitle()
    {
        $siteName  = $this->siteName();
        $pageTitle = strip_tags($this->title());

        if ($pageTitle) {
            if ($pageTitle === $siteName) {
                return sprintf('%1$s &#8212; Charcoal', $pageTitle);
            } else {
                return sprintf('%1$s &lsaquo; %2$s &#8212; Charcoal', $pageTitle, $siteName);
            }
        }

        return $siteName;
    }
1197560
public function getText() : ?string 
    {
        if ( ! $this->hasText()) {
            $this->setText($this->getDefaultText());
        }
        return $this->text;
    }
27461
private function getArticleTitle()
    {
        $originalTitle = null;

        if ($this->getTitle()) {
            $originalTitle = $this->getTitle();
        } else {
            $this->logger->debug('[Metadata] Could not find title in metadata, searching for the title tag...');
            $titleTag = $this->dom->getElementsByTagName('title');
            if ($titleTag->length > 0) {
                $this->logger->info(sprintf('[Metadata] Using title tag as article title: \'%s\'', $titleTag->item(0)->nodeValue));
                $originalTitle = $titleTag->item(0)->nodeValue;
            }
        }

        if ($originalTitle === null) {
            return null;
        }

        $curTitle = $originalTitle = trim($originalTitle);
        $titleHadHierarchicalSeparators = false;

        /*
         * If there's a separator in the title, first remove the final part
         *
         * Sanity warning: if you eval this match in PHPStorm's "Evaluate expression" box, it will return false
         * I can assure you it works properly if you let the code run.
         */
        if (preg_match('/ [\|\-\\\\\/>»] /i', $curTitle)) {
            $titleHadHierarchicalSeparators = (bool)preg_match('/ [\\\\\/>»] /', $curTitle);
            $curTitle = preg_replace('/(.*)[\|\-\\\\\/>»] .*/i', '$1', $originalTitle);

            $this->logger->info(sprintf('[Metadata] Found hierarchical separators in title, new title is: \'%s\'', $curTitle));

            // If the resulting title is too short (3 words or fewer), remove
            // the first part instead:
            if (count(preg_split('/\s+/', $curTitle)) < 3) {
                $curTitle = preg_replace('/[^\|\-\\\\\/>»]*[\|\-\\\\\/>»](.*)/i', '$1', $originalTitle);
                $this->logger->info(sprintf('[Metadata] Title too short, using the first part of the title instead: \'%s\'', $curTitle));
            }
        } elseif (strpos($curTitle, ': ') !== false) {
            // Check if we have an heading containing this exact string, so we
            // could assume it's the full title.
            $match = false;
            for ($i = 1; $i <= 2; $i++) {
                foreach ($this->dom->getElementsByTagName('h' . $i) as $hTag) {
                    // Trim texts to avoid having false negatives when the title is surrounded by spaces or tabs
                    if (trim($hTag->nodeValue) === trim($curTitle)) {
                        $match = true;
                    }
                }
            }

            // If we don't, let's extract the title out of the original title string.
            if (!$match) {
                $curTitle = substr($originalTitle, strrpos($originalTitle, ':') + 1);

                $this->logger->info(sprintf('[Metadata] Title has a colon in the middle, new title is: \'%s\'', $curTitle));

                // If the title is now too short, try the first colon instead:
                if (count(preg_split('/\s+/', $curTitle)) < 3) {
                    $curTitle = substr($originalTitle, strpos($originalTitle, ':') + 1);
                    $this->logger->info(sprintf('[Metadata] Title too short, using the first part of the title instead: \'%s\'', $curTitle));
                } elseif (count(preg_split('/\s+/', substr($curTitle, 0, strpos($curTitle, ':')))) > 5) {
                    // But if we have too many words before the colon there's something weird
                    // with the titles and the H tags so let's just use the original title instead
                    $curTitle = $originalTitle;
                }
            }
        } elseif (mb_strlen($curTitle) > 150 || mb_strlen($curTitle) < 15) {
            $hOnes = $this->dom->getElementsByTagName('h1');

            if ($hOnes->length === 1) {
                $curTitle = $hOnes->item(0)->nodeValue;
                $this->logger->info(sprintf('[Metadata] Using title from an H1 node: \'%s\'', $curTitle));
            }
        }

        $curTitle = trim($curTitle);

        /*
         * If we now have 4 words or fewer as our title, and either no
         * 'hierarchical' separators (\, /, > or ») were found in the original
         * title or we decreased the number of words by more than 1 word, use
         * the original title.
         */
        $curTitleWordCount = count(preg_split('/\s+/', $curTitle));
        $originalTitleWordCount = count(preg_split('/\s+/', preg_replace('/[\|\-\\\\\/>»]+/', '', $originalTitle))) - 1;

        if ($curTitleWordCount <= 4 &&
            (!$titleHadHierarchicalSeparators || $curTitleWordCount !== $originalTitleWordCount)) {
            $curTitle = $originalTitle;

            $this->logger->info(sprintf('Using title from an H1 node: \'%s\'', $curTitle));
        }

        return $curTitle;
    }