Use pageinfo and remove extension scanner false positive

As only pageinfo is used, only this is stored for now.
Also the single line accessing the property is marked to be ignored by
extension scanner.
This commit is contained in:
Daniel Siepmann 2020-04-01 11:45:27 +02:00
parent e5e5321140
commit 19ddacb246

View file

@ -29,15 +29,16 @@ use TYPO3\CMS\Frontend\Resource\FileCollector;
class PageLayoutHeader
{
/**
* @var PageLayoutController
* @var array
*/
private $pageLayoutController;
private $pageinfo;
public function render(
array $params,
PageLayoutController $pageLayoutController
): string {
$this->pageLayoutController = $pageLayoutController;
// @extensionScannerIgnoreLine At least in v10 this is a false positive
$this->pageinfo = $pageLayoutController->pageinfo;
// TODO: Check whether two levels up is uid 2, which holds all blog posts
// To prevent rendering on non blog posts
@ -45,29 +46,29 @@ class PageLayoutHeader
$view = $this->getView();
$view->assignMultiple([
'record' => $this->pageLayoutController->pageinfo,
'record' => $this->pageinfo,
'metaInfo' => [
[
'label' => 'meta-description',
'value' => $this->pageLayoutController->pageinfo['description'],
'value' => $this->pageinfo['description'],
'field' => 'description',
'type' => 'string',
],
[
'label' => 'introduction',
'value' => $this->pageLayoutController->pageinfo['abstract'],
'value' => $this->pageinfo['abstract'],
'field' => 'abstract',
'type' => 'string',
],
[
'label' => 'published',
'value' => $this->pageLayoutController->pageinfo['lastUpdated'],
'value' => $this->pageinfo['lastUpdated'],
'field' => 'lastUpdated',
'type' => 'date',
],
[
'label' => 'updated',
'value' => $this->pageLayoutController->pageinfo['SYS_LASTCHANGED'],
'value' => $this->pageinfo['SYS_LASTCHANGED'],
'type' => 'date',
],
[
@ -90,7 +91,7 @@ class PageLayoutHeader
private function resolvePageMedia(): array
{
$page = ['uid' => $this->pageLayoutController->pageinfo['uid']];
$page = ['uid' => $this->pageinfo['uid']];
$files = new FileCollector();
$files->addFilesFromRelation('pages', 'media', $page);