TASK: Check multiple fields for pages to be used as title

This commit is contained in:
Daniel Siepmann 2017-07-20 14:22:52 +02:00
parent a737501dac
commit 7722c37ea5
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4

View file

@ -57,6 +57,14 @@ class PagesIndexer extends TcaIndexer
*/ */
protected function prepareRecord(array &$record) protected function prepareRecord(array &$record)
{ {
$possibleTitleFields = ['nav_title', 'tx_tqseo_pagetitle_rel', 'title'];
foreach ($possibleTitleFields as $searchTitleField) {
if (isset($record[$searchTitleField]) && trim($record[$searchTitleField])) {
$record['search_title'] = trim($record[$searchTitleField]);
break;
}
}
$record['content'] = $this->fetchContentForPage($record['uid']); $record['content'] = $this->fetchContentForPage($record['uid']);
parent::prepareRecord($record); parent::prepareRecord($record);
} }