@@ -51,6 +51,11 @@ class H5pModuleController extends ActionController
51
51
*/
52
52
public $ perms_clause ;
53
53
54
+ /**
55
+ * @var bool
56
+ */
57
+ protected $ h5pContentAllowedOnPage = false ;
58
+
54
59
/**
55
60
* @var string
56
61
*/
@@ -136,6 +141,15 @@ public function initializeAction()
136
141
$ this ->isAccessibleForCurrentUser = false ;
137
142
}
138
143
144
+ // Get extension configuration
145
+ $ allowContentOnStandardPages = false ;
146
+ $ extConf = unserialize ($ GLOBALS ['TYPO3_CONF_VARS ' ]['EXT ' ]['extConf ' ]['h5p ' ]);
147
+ if (!isset ($ extConf ['onlyAllowRecordsInSysfolders ' ]) || (int )$ extConf ['onlyAllowRecordsInSysfolders ' ] === 0 ) {
148
+ $ allowContentOnStandardPages = true ;
149
+ }
150
+ $ pageIsSysfolder = (int )$ this ->pageRecord ['doktype ' ] === 254 ;
151
+ $ this ->h5pContentAllowedOnPage = $ allowContentOnStandardPages || $ pageIsSysfolder ;
152
+
139
153
// read configuration
140
154
$ modTS = $ backendUser ->getTSConfig ('mod.recycler ' );
141
155
if ($ this ->isCurrentUserAdmin ()) {
@@ -233,14 +247,16 @@ protected function registerDocheaderButtons()
233
247
->setGetVariables ($ getVars );
234
248
$ buttonBar ->addButton ($ shortcutButton );
235
249
236
- if (in_array ($ this ->request ->getControllerActionName (), ['content ' , 'index ' , 'show ' ])) {
237
- $ title = $ this ->getLanguageService ()->sL ('LLL:EXT:h5p/Resources/Private/Language/locallang.xlf:module.menu.new ' );
238
- $ icon = $ this ->view ->getModuleTemplate ()->getIconFactory ()->getIcon ('actions-document-new ' , Icon::SIZE_SMALL );
239
- $ addUserButton = $ buttonBar ->makeLinkButton ()
240
- ->setHref ($ this ->getHref ('H5pModule ' , 'new ' ))
241
- ->setTitle ($ title )
242
- ->setIcon ($ icon );
243
- $ buttonBar ->addButton ($ addUserButton , ButtonBar::BUTTON_POSITION_LEFT );
250
+ if ($ this ->h5pContentAllowedOnPage ) {
251
+ if (in_array ($ this ->request ->getControllerActionName (), ['content ' , 'index ' , 'show ' ])) {
252
+ $ title = $ this ->getLanguageService ()->sL ('LLL:EXT:h5p/Resources/Private/Language/locallang.xlf:module.menu.new ' );
253
+ $ icon = $ this ->view ->getModuleTemplate ()->getIconFactory ()->getIcon ('actions-document-new ' , Icon::SIZE_SMALL );
254
+ $ addUserButton = $ buttonBar ->makeLinkButton ()
255
+ ->setHref ($ this ->getHref ('H5pModule ' , 'new ' ))
256
+ ->setTitle ($ title )
257
+ ->setIcon ($ icon );
258
+ $ buttonBar ->addButton ($ addUserButton , ButtonBar::BUTTON_POSITION_LEFT );
259
+ }
244
260
}
245
261
246
262
if (in_array ($ this ->request ->getControllerActionName (), ['show ' ])) {
@@ -293,11 +309,13 @@ protected function generateMenu()
293
309
'action ' => 'content ' ,
294
310
'label ' => $ this ->getLanguageService ()->sL ('LLL:EXT:h5p/Resources/Private/Language/locallang.xlf:module.menu.content ' )
295
311
];
296
- $ menuItems ['new ' ] = [
297
- 'controller ' => 'H5pModule ' ,
298
- 'action ' => 'new ' ,
299
- 'label ' => $ this ->getLanguageService ()->sL ('LLL:EXT:h5p/Resources/Private/Language/locallang.xlf:module.menu.new ' )
300
- ];
312
+ if ($ this ->h5pContentAllowedOnPage ) {
313
+ $ menuItems ['new ' ] = [
314
+ 'controller ' => 'H5pModule ' ,
315
+ 'action ' => 'new ' ,
316
+ 'label ' => $ this ->getLanguageService ()->sL ('LLL:EXT:h5p/Resources/Private/Language/locallang.xlf:module.menu.new ' )
317
+ ];
318
+ }
301
319
$ menuItems ['libraries ' ] = [
302
320
'controller ' => 'H5pModule ' ,
303
321
'action ' => 'libraries ' ,
@@ -336,6 +354,7 @@ public function indexAction()
336
354
$ contentRepository = $ this ->objectManager ->get (ContentRepository::class);
337
355
$ content = $ contentRepository ->findAll ();
338
356
357
+ $ this ->view ->assign ('h5pContentAllowedOnPage ' , $ this ->h5pContentAllowedOnPage );
339
358
$ this ->view ->assign ('dateFormat ' , $ GLOBALS ['TYPO3_CONF_VARS ' ]['SYS ' ]['ddmmyy ' ]);
340
359
$ this ->view ->assign ('timeFormat ' , $ GLOBALS ['TYPO3_CONF_VARS ' ]['SYS ' ]['hhmm ' ]);
341
360
$ this ->view ->assign ('id ' , $ this ->id );
@@ -357,6 +376,7 @@ public function contentAction()
357
376
$ contentRepository = $ this ->objectManager ->get (ContentRepository::class);
358
377
$ content = $ contentRepository ->findByPid ($ this ->id );
359
378
379
+ $ this ->view ->assign ('h5pContentAllowedOnPage ' , $ this ->h5pContentAllowedOnPage );
360
380
$ this ->view ->assign ('dateFormat ' , $ GLOBALS ['TYPO3_CONF_VARS ' ]['SYS ' ]['ddmmyy ' ]);
361
381
$ this ->view ->assign ('timeFormat ' , $ GLOBALS ['TYPO3_CONF_VARS ' ]['SYS ' ]['hhmm ' ]);
362
382
$ this ->view ->assign ('id ' , $ this ->id );
@@ -885,6 +905,7 @@ public function consentAction()
885
905
public function newAction (int $ contentId = 0 )
886
906
{
887
907
$ this ->view ->assign ('didConsent ' , (int )$ this ->h5pFramework ->getOption ('hub_is_enabled ' ) === 1 );
908
+ $ this ->view ->assign ('h5pContentAllowedOnPage ' , $ this ->h5pContentAllowedOnPage );
888
909
889
910
$ this ->view ->getModuleTemplate ()->getPageRenderer ()->addInlineLanguageLabelFile ('EXT:h5p/Resources/Private/Language/locallang.xlf ' );
890
911
if ($ this ->isAccessibleForCurrentUser ) {
0 commit comments