2626use TYPO3 \CMS \ContentBlocks \Definition \ContentType \PageTypeDefinition ;
2727use TYPO3 \CMS \ContentBlocks \Definition \TableDefinitionCollection ;
2828use TYPO3 \CMS \ContentBlocks \Registry \ContentBlockRegistry ;
29- use TYPO3 \CMS \ContentBlocks \UserFunction \ContentWhere ;
3029use TYPO3 \CMS \ContentBlocks \Utility \ContentBlockPathUtility ;
3130use TYPO3 \CMS \Core \Core \Event \BootCompletedEvent ;
3231use TYPO3 \CMS \Core \Database \Connection ;
@@ -58,7 +57,6 @@ protected static function getPackageName(): string
5857 public function getFactories (): array
5958 {
6059 return [
61- ContentWhere::class => static ::getContentWhere (...),
6260 'content-blocks.icons ' => static ::getContentBlockIcons (...),
6361 'content-blocks.page-types ' => static ::getContentBlockPageTypes (...),
6462 'content-blocks.typoscript ' => static ::getContentBlockTypoScript (...),
@@ -79,19 +77,6 @@ public function getExtensions(): array
7977 ] + parent ::getExtensions ();
8078 }
8179
82- public static function getContentWhere (ContainerInterface $ container ): ContentWhere
83- {
84- $ arrayObject = $ container ->get ('content-blocks.parent-field-names ' );
85- $ parentFieldNames = $ arrayObject ->getArrayCopy ();
86- return self ::new (
87- $ container ,
88- ContentWhere::class,
89- [
90- $ parentFieldNames ,
91- ]
92- );
93- }
94-
9580 public static function getContentBlockIcons (ContainerInterface $ container ): \ArrayObject
9681 {
9782 $ arrayObject = new \ArrayObject ();
@@ -200,16 +185,15 @@ public static function getContentBlockTypoScript(ContainerInterface $container):
200185 return $ arrayObject ;
201186 }
202187
203- public static function getContentBlockParentFieldNames (ContainerInterface $ container ): \ ArrayObject
188+ public static function getContentBlockParentFieldNames (ContainerInterface $ container ): array
204189 {
205- $ arrayObject = new \ArrayObject ();
206190 $ cache = $ container ->get ('cache.core ' );
207191 $ typoScriptFromCache = $ cache ->require ('ContentBlocks_ParentFieldNames ' );
208192 if ($ typoScriptFromCache !== false ) {
209- $ arrayObject ->exchangeArray ($ typoScriptFromCache );
210- return $ arrayObject ;
193+ return $ typoScriptFromCache ;
211194 }
212195
196+ $ arrayObject = [];
213197 /** @var TableDefinitionCollection $tableDefinitionCollection */
214198 $ tableDefinitionCollection = $ container ->get (TableDefinitionCollection::class);
215199 $ contentElementTable = ContentType::CONTENT_ELEMENT ->getTable ();
@@ -223,9 +207,9 @@ public static function getContentBlockParentFieldNames(ContainerInterface $conta
223207 $ fieldNames [$ foreignField ] = $ foreignField ;
224208 }
225209 }
226- $ arrayObject-> exchangeArray ( array_values ($ fieldNames) );
210+ $ arrayObject = array_values ($ fieldNames );
227211 }
228- $ cache ->set ('ContentBlocks_ParentFieldNames ' , 'return ' . var_export ($ arrayObject-> getArrayCopy () , true ) . '; ' );
212+ $ cache ->set ('ContentBlocks_ParentFieldNames ' , 'return ' . var_export ($ arrayObject , true ) . '; ' );
229213 return $ arrayObject ;
230214 }
231215
@@ -241,8 +225,7 @@ public static function addTypoScript(ContainerInterface $container): \Closure
241225 public static function hideContentElementChildren (ContainerInterface $ container ): \Closure
242226 {
243227 return static function (ModifyDatabaseQueryForContentEvent $ event ) use ($ container ) {
244- $ arrayObject = $ container ->get ('content-blocks.parent-field-names ' );
245- $ parentFieldNames = $ arrayObject ->getArrayCopy ();
228+ $ parentFieldNames = $ container ->get ('content-blocks.parent-field-names ' );
246229 $ queryBuilder = $ event ->getQueryBuilder ();
247230 foreach ($ parentFieldNames as $ fieldName ) {
248231 $ queryBuilder ->andWhere (
@@ -284,8 +267,7 @@ public static function recordSummaryForLocalization(ContainerInterface $containe
284267 {
285268 return static function (AfterRecordSummaryForLocalizationEvent $ event ) use ($ container ) {
286269 $ recordsPerColumn = $ event ->getRecords ();
287- $ arrayObject = $ container ->get ('content-blocks.parent-field-names ' );
288- $ parentFieldNames = $ arrayObject ->getArrayCopy ();
270+ $ parentFieldNames = $ container ->get ('content-blocks.parent-field-names ' );
289271 $ allUids = [];
290272 foreach ($ recordsPerColumn as $ records ) {
291273 foreach ($ records as $ record ) {
@@ -361,7 +343,6 @@ public static function addEventListeners(ContainerInterface $container, Listener
361343 $ listenerProvider ->addListener (BootCompletedEvent::class, 'content-blocks.add-typoscript ' );
362344 $ listenerProvider ->addListener (ModifyDatabaseQueryForContentEvent::class, 'content-blocks.hide-content-element-children ' );
363345 $ listenerProvider ->addListener (AfterContentHasBeenFetchedEvent::class, 'content-blocks.hide-content-element-children-page-content-fetching ' );
364- $ listenerProvider ->addListener (AfterRecordSummaryForLocalizationEvent::class, 'content-blocks.record-summary-for-localization ' );
365346 return $ listenerProvider ;
366347 }
367348}
0 commit comments