|
1
|
|
|
<?php |
|
2
|
|
|
namespace Aoe\Asdis\Typo3\Hook; |
|
3
|
|
|
|
|
4
|
|
|
use Aoe\Asdis\Domain\Model\Asset\Collection; |
|
5
|
|
|
use Aoe\Asdis\Domain\Model\Page; |
|
6
|
|
|
use Aoe\Asdis\System\Configuration\Provider; |
|
7
|
|
|
use Aoe\Asdis\System\Log\Logger; |
|
8
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
|
9
|
|
|
use TYPO3\CMS\Extbase\Object\ObjectManager; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* Abstract hook class. |
|
13
|
|
|
*/ |
|
14
|
|
|
abstract class AbstractHook |
|
15
|
|
|
{ |
|
16
|
|
|
/** |
|
17
|
|
|
* @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface |
|
18
|
|
|
*/ |
|
19
|
|
|
private $objectManager; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* @var \Aoe\Asdis\System\Log\Logger |
|
23
|
|
|
*/ |
|
24
|
|
|
private $logger; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* @var \Aoe\Asdis\Domain\Model\Page |
|
28
|
|
|
*/ |
|
29
|
|
|
private $page; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @var \Aoe\Asdis\System\Configuration\Provider |
|
33
|
|
|
*/ |
|
34
|
|
|
private $configurationProvider; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Constructor. |
|
38
|
|
|
*/ |
|
39
|
|
|
public function __construct() |
|
40
|
|
|
{ |
|
41
|
|
|
$this->objectManager = GeneralUtility::makeInstance(ObjectManager::class); |
|
42
|
|
|
$this->configurationProvider = $this->objectManager->get(Provider::class); |
|
43
|
|
|
$this->logger = $this->objectManager->get(Logger::class); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* @return \Aoe\Asdis\System\Configuration\Provider |
|
48
|
|
|
*/ |
|
49
|
|
|
protected function getConfigurationProvider() |
|
50
|
|
|
{ |
|
51
|
|
|
return $this->configurationProvider; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* @return \Aoe\Asdis\System\Log\Logger |
|
56
|
|
|
*/ |
|
57
|
|
|
protected function getLogger() |
|
58
|
|
|
{ |
|
59
|
|
|
return $this->logger; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* @return void |
|
64
|
|
|
*/ |
|
65
|
|
|
protected function scrapeAssets() |
|
66
|
|
|
{ |
|
67
|
|
|
$this->page->scrapeAssets(); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* @return void |
|
72
|
|
|
*/ |
|
73
|
|
|
protected function replaceAssets() |
|
74
|
|
|
{ |
|
75
|
|
|
$this->page->replaceAssets(); |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* Scrapes and replaces the assets of the current page. |
|
80
|
|
|
* |
|
81
|
|
|
* @return void |
|
82
|
|
|
*/ |
|
83
|
|
|
protected function scrapeAndReplace() |
|
84
|
|
|
{ |
|
85
|
|
|
$this->scrapeAssets(); |
|
86
|
|
|
$this->replaceAssets(); |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* @param \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $pObj |
|
91
|
|
|
*/ |
|
92
|
|
|
protected function setPageObject(\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $pObj) |
|
93
|
|
|
{ |
|
94
|
|
|
/** @var Tx_Asdis_Domain_Model_Page $page */ |
|
95
|
|
|
$page = $this->objectManager->get(Page::class); |
|
|
|
|
|
|
96
|
|
|
$page->setAssets($this->objectManager->get(Collection::class)); |
|
|
|
|
|
|
97
|
|
|
$page->setPageObject($pObj); |
|
98
|
|
|
$this->page = $page; |
|
99
|
|
|
} |
|
100
|
|
|
} |
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.