[TASK] Deprecate PageRenderer->loadJQuery()
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Classes / Template / ModuleTemplate.php
1 <?php
2 namespace TYPO3\CMS\Backend\Template;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 use TYPO3\CMS\Backend\Backend\Shortcut\ShortcutRepository;
18 use TYPO3\CMS\Backend\Template\Components\DocHeaderComponent;
19 use TYPO3\CMS\Backend\Utility\BackendUtility;
20 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
21 use TYPO3\CMS\Core\Imaging\Icon;
22 use TYPO3\CMS\Core\Imaging\IconFactory;
23 use TYPO3\CMS\Core\Localization\LanguageService;
24 use TYPO3\CMS\Core\Messaging\AbstractMessage;
25 use TYPO3\CMS\Core\Messaging\FlashMessageService;
26 use TYPO3\CMS\Core\Page\PageRenderer;
27 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
28 use TYPO3\CMS\Core\Utility\GeneralUtility;
29 use TYPO3\CMS\Fluid\View\Exception\InvalidTemplateResourceException;
30 use TYPO3\CMS\Fluid\View\StandaloneView;
31
32 /**
33 * A class taking care of the "outer" HTML of a module, especially
34 * the doc header and other related parts.
35 *
36 * @internal This API is not yet carved in stone and may be adapted later.
37 */
38 class ModuleTemplate
39 {
40 /**
41 * Error Icon Constant
42 *
43 * @internal
44 */
45 const STATUS_ICON_ERROR = 3;
46
47 /**
48 * Warning Icon Constant
49 *
50 * @internal
51 */
52 const STATUS_ICON_WARNING = 2;
53
54 /**
55 * Notification Icon Constant
56 *
57 * @internal
58 */
59 const STATUS_ICON_NOTIFICATION = 1;
60
61 /**
62 * OK Icon Constant
63 *
64 * @internal
65 */
66 const STATUS_ICON_OK = -1;
67
68 /**
69 * DocHeaderComponent
70 *
71 * @var DocHeaderComponent
72 */
73 protected $docHeaderComponent;
74
75 /**
76 * Javascript Code Array
77 * Used for inline JS
78 *
79 * @var array
80 */
81 protected $javascriptCodeArray = [];
82
83 /**
84 * Expose the pageRenderer
85 *
86 * @var PageRenderer
87 */
88 protected $pageRenderer;
89
90 /**
91 * @var bool
92 */
93 protected $uiBlock = false;
94
95 /**
96 * TemplateRootPath
97 *
98 * @var string[]
99 */
100 protected $templateRootPaths = ['EXT:backend/Resources/Private/Templates'];
101
102 /**
103 * PartialRootPath
104 *
105 * @var string[]
106 */
107 protected $partialRootPaths = ['EXT:backend/Resources/Private/Partials'];
108
109 /**
110 * LayoutRootPath
111 *
112 * @var string[]
113 */
114 protected $layoutRootPaths = ['EXT:backend/Resources/Private/Layouts'];
115
116 /**
117 * Template name
118 *
119 * @var string
120 */
121 protected $templateFile = 'Module.html';
122
123 /**
124 * Fluid Standalone View
125 *
126 * @var StandaloneView
127 */
128 protected $view;
129
130 /**
131 * Content String
132 *
133 * @var string
134 */
135 protected $content = '';
136
137 /**
138 * IconFactory Member
139 *
140 * @var IconFactory
141 */
142 protected $iconFactory;
143
144 /**
145 * Module ID
146 *
147 * @var string
148 */
149 protected $moduleId = '';
150
151 /**
152 * Module Name
153 *
154 * @var string
155 */
156 protected $moduleName = '';
157
158 /**
159 * Title Tag
160 *
161 * @var string
162 */
163 protected $title = '';
164
165 /**
166 * Body Tag
167 *
168 * @var string
169 */
170 protected $bodyTag = '<body>';
171
172 /**
173 * Flash message queue
174 *
175 * @var \TYPO3\CMS\Core\Messaging\FlashMessageQueue
176 */
177 protected $flashMessageQueue;
178
179 /**
180 * Returns the current body tag
181 *
182 * @return string
183 */
184 public function getBodyTag()
185 {
186 return $this->bodyTag;
187 }
188
189 /**
190 * Sets the body tag
191 *
192 * @param string $bodyTag
193 * @return self
194 */
195 public function setBodyTag($bodyTag): self
196 {
197 $this->bodyTag = $bodyTag;
198 return $this;
199 }
200
201 /**
202 * Gets the standalone view.
203 *
204 * @return StandaloneView
205 */
206 public function getView()
207 {
208 return $this->view;
209 }
210
211 /**
212 * Set content
213 *
214 * @param string $content Content of the module
215 * @return self
216 */
217 public function setContent($content): self
218 {
219 $this->view->assign('content', $content);
220 return $this;
221 }
222
223 /**
224 * Set title tag
225 *
226 * @param string $title
227 * @return self
228 */
229 public function setTitle($title): self
230 {
231 $this->title = $title;
232 return $this;
233 }
234
235 /**
236 * Returns the IconFactory
237 *
238 * @return IconFactory
239 */
240 public function getIconFactory()
241 {
242 return $this->iconFactory;
243 }
244
245 /**
246 * Class constructor
247 * Sets up view and property objects
248 *
249 * @throws InvalidTemplateResourceException In case a template is invalid
250 */
251 public function __construct()
252 {
253 $this->view = GeneralUtility::makeInstance(StandaloneView::class);
254 $this->view->setPartialRootPaths($this->partialRootPaths);
255 $this->view->setTemplateRootPaths($this->templateRootPaths);
256 $this->view->setLayoutRootPaths($this->layoutRootPaths);
257 $this->view->setTemplate($this->templateFile);
258 $this->pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
259 $this->docHeaderComponent = GeneralUtility::makeInstance(DocHeaderComponent::class);
260 $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
261 }
262
263 /**
264 * Loads all necessary Javascript Files
265 */
266 protected function loadJavaScripts()
267 {
268 $this->pageRenderer->loadRequireJsModule('bootstrap');
269 $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/ContextHelp');
270 $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/DocumentHeader');
271 $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/SplitButtons');
272 }
273
274 /**
275 * Loads all necessary stylesheets
276 */
277 protected function loadStylesheets()
278 {
279 if (!empty($GLOBALS['TBE_STYLES']['stylesheet'])) {
280 $this->pageRenderer->addCssFile($GLOBALS['TBE_STYLES']['stylesheet']);
281 }
282 if (!empty($GLOBALS['TBE_STYLES']['stylesheet2'])) {
283 $this->pageRenderer->addCssFile($GLOBALS['TBE_STYLES']['stylesheet2']);
284 }
285 }
286
287 /**
288 * Sets mandatory parameters for the view (pageRenderer)
289 */
290 protected function setupPage()
291 {
292 // Yes, hardcoded on purpose
293 $this->pageRenderer->setXmlPrologAndDocType('<!DOCTYPE html>');
294 $this->pageRenderer->setCharSet('utf-8');
295 $this->pageRenderer->setLanguage($GLOBALS['LANG']->lang);
296 $this->pageRenderer->setMetaTag('name', 'viewport', 'width=device-width, initial-scale=1');
297 }
298
299 /**
300 * Wrapper function for adding JS inline blocks
301 */
302 protected function setJavaScriptCodeArray()
303 {
304 foreach ($this->javascriptCodeArray as $name => $code) {
305 $this->pageRenderer->addJsInlineCode($name, $code, false);
306 }
307 }
308
309 /**
310 * Adds JS inline blocks of code to the internal registry
311 *
312 * @param string $name Javascript code block name
313 * @param string $code Inline Javascript
314 * @return self
315 */
316 public function addJavaScriptCode($name = '', $code = ''): self
317 {
318 $this->javascriptCodeArray[$name] = $code;
319 return $this;
320 }
321
322 /**
323 * Get the DocHeader
324 *
325 * @return DocHeaderComponent
326 */
327 public function getDocHeaderComponent()
328 {
329 return $this->docHeaderComponent;
330 }
331
332 /**
333 * Returns the fully rendered view
334 *
335 * @return string
336 */
337 public function renderContent()
338 {
339 $this->setupPage();
340 $this->pageRenderer->setTitle($this->title);
341 $this->loadJavaScripts();
342 $this->setJavaScriptCodeArray();
343 $this->loadStylesheets();
344
345 $this->view->assign('docHeader', $this->docHeaderComponent->docHeaderContent());
346 if ($this->moduleId) {
347 $this->view->assign('moduleId', $this->moduleId);
348 }
349 if ($this->moduleName) {
350 $this->view->assign('moduleName', $this->moduleName);
351 }
352 $this->view->assign('uiBlock', $this->uiBlock);
353 $this->view->assign('flashMessageQueueIdentifier', $this->getFlashMessageQueue()->getIdentifier());
354 $renderedPage = $this->pageRenderer->render(PageRenderer::PART_HEADER);
355 $renderedPage .= $this->bodyTag;
356 $renderedPage .= $this->view->render();
357 $this->pageRenderer->addJsFooterInlineCode('updateSignals', BackendUtility::getUpdateSignalCode());
358 $renderedPage .= $this->pageRenderer->render(PageRenderer::PART_FOOTER);
359
360 return $renderedPage;
361 }
362
363 /**
364 * Get PageRenderer
365 *
366 * @return PageRenderer
367 */
368 public function getPageRenderer()
369 {
370 return $this->pageRenderer;
371 }
372
373 /**
374 * Set form tag
375 *
376 * @param string $formTag Form tag to add
377 * @return self
378 */
379 public function setForm($formTag = ''): self
380 {
381 $this->view->assign('formTag', $formTag);
382 return $this;
383 }
384
385 /**
386 * Sets the ModuleId
387 *
388 * @param string $moduleId ID of the module
389 * @return self
390 */
391 public function setModuleId($moduleId): self
392 {
393 $this->moduleId = $moduleId;
394 $this->registerModuleMenu($moduleId);
395 return $this;
396 }
397
398 /**
399 * Sets the ModuleName
400 *
401 * @param string $moduleName Name of the module
402 * @return self
403 */
404 public function setModuleName($moduleName): self
405 {
406 $this->moduleName = $moduleName;
407 return $this;
408 }
409
410 /**
411 * Generates the Menu for things like Web->Info
412 *
413 * @param $moduleMenuIdentifier
414 * @return self
415 */
416 public function registerModuleMenu($moduleMenuIdentifier): self
417 {
418 if (isset($GLOBALS['TBE_MODULES_EXT'][$moduleMenuIdentifier])) {
419 $menuEntries =
420 $GLOBALS['TBE_MODULES_EXT'][$moduleMenuIdentifier]['MOD_MENU']['function'];
421 $menu = $this->getDocHeaderComponent()->getMenuRegistry()->makeMenu()->setIdentifier('MOD_FUNC');
422 foreach ($menuEntries as $menuEntry) {
423 $menuItem = $menu->makeMenuItem()
424 ->setTitle($menuEntry['title'])
425 ->setHref('#');
426 $menu->addMenuItem($menuItem);
427 }
428 $this->docHeaderComponent->getMenuRegistry()->addMenu($menu);
429 }
430 return $this;
431 }
432
433 /**
434 * Creates a tab menu where the tabs or collapsible are rendered with bootstrap markup
435 *
436 * @param array $menuItems Tab elements, each element is an array with "label" and "content"
437 * @param string $domId DOM id attribute, will be appended with an iteration number per tab.
438 * @param int $defaultTabIndex Default tab to open (for toggle <=0). Value corresponds to integer-array index + 1
439 * (index zero is "1", index "1" is 2 etc.). A value of zero (or something non-existing
440 * will result in no default tab open.
441 * @param bool $collapsible If set, the tabs are rendered as headers instead over each sheet. Effectively this means
442 * there is no tab menu, but rather a foldout/fold-in menu.
443 * @param bool $wrapContent If set, the content is wrapped in div structure which provides a padding and border
444 * style. Set this FALSE to get unstyled content pane with fullsize content area.
445 * @param bool $storeLastActiveTab If set, the last open tab is stored in local storage and will be re-open again.
446 * If you don't need this feature, e.g. for wizards like import/export you can
447 * disable this behaviour.
448 * @return string
449 */
450 public function getDynamicTabMenu(array $menuItems, $domId, $defaultTabIndex = 1, $collapsible = false, $wrapContent = true, $storeLastActiveTab = true)
451 {
452 $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Tabs');
453 $templatePath = ExtensionManagementUtility::extPath('backend')
454 . 'Resources/Private/Templates/DocumentTemplate/';
455 $view = GeneralUtility::makeInstance(StandaloneView::class);
456 $view->setTemplatePathAndFilename($templatePath . ($collapsible ? 'Collapse.html' : 'Tabs.html'));
457 $view->setPartialRootPaths([$templatePath . 'Partials']);
458 $view->assignMultiple([
459 'id' => 'DTM-' . GeneralUtility::shortMD5($domId),
460 'items' => $menuItems,
461 'defaultTabIndex' => $defaultTabIndex,
462 'wrapContent' => $wrapContent,
463 'storeLastActiveTab' => $storeLastActiveTab,
464 ]);
465 return $view->render();
466 }
467
468 /*******************************************
469 * THE FOLLOWING METHODS ARE SUBJECT TO BE DEPRECATED / DROPPED!
470 *
471 * These methods have been copied over from DocumentTemplate and enables
472 * core modules to drop the dependency to DocumentTemplate altogether without
473 * rewriting these modules now.
474 * The methods below are marked as internal and will be removed
475 * one-by-one with further refactoring of modules.
476 *
477 * Do not use these methods within own extensions if possible or
478 * be prepared to change this later again.
479 *******************************************/
480
481 /**
482 * Includes a javascript library that exists in the core /typo3/ directory
483 *
484 * @param string $lib Library name. Call it with the full path like
485 * "sysext/core/Resources/Public/JavaScript/QueryGenerator.js" to load it
486 *
487 * @internal
488 * @return self
489 * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10, use PageRenderer directly.
490 * @see \TYPO3\CMS\Core\Page\PageRenderer::addJsFile
491 */
492 public function loadJavascriptLib($lib): self
493 {
494 trigger_error('The method `TYPO3\CMS\Backend\Template\ModuleTemplate::loadJavascriptLib()` has been deprecated and should not be used any longer, this method will be removed in TYPO3 v10.0', E_USER_DEPRECATED);
495 $this->pageRenderer->addJsFile($lib);
496 return $this;
497 }
498
499 /**
500 * Returns a linked shortcut-icon which will call the shortcut frame and set a
501 * shortcut there back to the calling page/module
502 *
503 * @param string $gvList Is the list of GET variables to store (if any)
504 * @param string $setList Is the list of SET[] variables to store
505 * (if any) - SET[] variables a stored in $GLOBALS["SOBE"]->MOD_SETTINGS
506 * for backend modules
507 * @param string $modName Module name string
508 * @param string|int $motherModName Is used to enter the "parent module
509 * name" if the module is a submodule under eg. Web>* or File>*. You
510 * can also set this value to 1 in which case the currentLoadedModule
511 * is sent to the shortcut script (so - not a fixed value!) - that is used
512 * in file_edit and wizard_rte modules where those are really running as
513 * a part of another module.
514 * @param string $displayName When given this name is used instead of the
515 * module name.
516 * @param string $classes Additional CSS classes for the link around the icon
517 *
518 * @return string HTML content
519 * @todo Make this thing return a button object
520 * @internal
521 */
522 public function makeShortcutIcon($gvList, $setList, $modName, $motherModName = '', $displayName = '', $classes = 'btn btn-default btn-sm')
523 {
524 $gvList = 'route,id,' . $gvList;
525 $storeUrl = $this->makeShortcutUrl($gvList, $setList);
526 $pathInfo = parse_url(GeneralUtility::getIndpEnv('REQUEST_URI'));
527 // Fallback for alt_mod. We still pass in the old xMOD... stuff,
528 // but TBE_MODULES only knows about "record_edit".
529 // We still need to pass the xMOD name to createShortcut below,
530 // since this is used for icons.
531 $moduleName = $modName === 'xMOD_alt_doc.php' ? 'record_edit' : $modName;
532 // Add the module identifier automatically if typo3/index.php is used:
533 // @todo: routing
534 if (GeneralUtility::_GET('route') !== null) {
535 $storeUrl = '&route=' . $moduleName . $storeUrl;
536 }
537 if ((int)$motherModName === 1) {
538 $motherModule = 'top.currentModuleLoaded';
539 } elseif ($motherModName) {
540 $motherModule = GeneralUtility::quoteJSvalue($motherModName);
541 } else {
542 $motherModule = '\'\'';
543 }
544 $confirmationText = GeneralUtility::quoteJSvalue(
545 $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.makeBookmark')
546 );
547
548 $shortcutUrl = $pathInfo['path'] . '?' . $storeUrl;
549 $shortcutRepository = GeneralUtility::makeInstance(ShortcutRepository::class);
550 $shortcutExist = $shortcutRepository->shortcutExists($shortcutUrl);
551
552 if ($shortcutExist) {
553 return '<a class="active ' . htmlspecialchars($classes) . '" title="">' .
554 $this->iconFactory->getIcon('actions-system-shortcut-active', Icon::SIZE_SMALL)->render() . '</a>';
555 }
556
557 $url = GeneralUtility::quoteJSvalue(rawurlencode($shortcutUrl));
558 $onClick = 'top.TYPO3.ShortcutMenu.createShortcut(' . GeneralUtility::quoteJSvalue(rawurlencode($modName)) .
559 ', ' . $url . ', ' . $confirmationText . ', ' . $motherModule . ', this, ' . GeneralUtility::quoteJSvalue($displayName) . ');return false;';
560
561 return '<a href="#" class="' . htmlspecialchars($classes) . '" onclick="' . htmlspecialchars($onClick) . '" title="' .
562 htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.makeBookmark')) . '">' .
563 $this->iconFactory->getIcon('actions-system-shortcut-new', Icon::SIZE_SMALL)->render() . '</a>';
564 }
565
566 /**
567 * MAKE url for storing
568 * Internal func
569 *
570 * @param string $gvList Is the list of GET variables to store (if any)
571 * @param string $setList Is the list of SET[] variables to store (if any)
572 * - SET[] variables a stored in $GLOBALS["SOBE"]->MOD_SETTINGS for backend
573 * modules
574 *
575 * @return string
576 * @internal
577 */
578 public function makeShortcutUrl($gvList, $setList)
579 {
580 $getParams = GeneralUtility::_GET();
581 $storeArray = array_merge(
582 GeneralUtility::compileSelectedGetVarsFromArray($gvList, $getParams),
583 ['SET' => GeneralUtility::compileSelectedGetVarsFromArray($setList, (array)$GLOBALS['SOBE']->MOD_SETTINGS)]
584 );
585 return GeneralUtility::implodeArrayForUrl('', $storeArray);
586 }
587
588 /**
589 * Returns the BE USER Object
590 *
591 * @return BackendUserAuthentication
592 */
593 protected function getBackendUserAuthentication()
594 {
595 return $GLOBALS['BE_USER'];
596 }
597
598 /**
599 * Returns the LanguageService
600 *
601 * @return LanguageService
602 */
603 protected function getLanguageService()
604 {
605 return $GLOBALS['LANG'];
606 }
607
608 /**
609 * Returns an image-tag with an 18x16 icon of the following types:
610 *
611 * $type:
612 * -1:» OK icon (Check-mark)
613 * 1:» Notice (Speach-bubble)
614 * 2:» Warning (Yellow triangle)
615 * 3:» Fatal error (Red stop sign)
616 *
617 * @param int $type See description
618 *
619 * @return string HTML image tag (if applicable)
620 * @internal
621 * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10
622 */
623 public function icons($type)
624 {
625 trigger_error('The method `TYPO3\CMS\Backend\Template\ModuleTemplate::icons()` has been deprecated and should not be used any longer, this method will be removed in TYPO3 v10.0', E_USER_DEPRECATED);
626 $icon = '';
627 switch ($type) {
628 case self::STATUS_ICON_ERROR:
629 $icon = 'status-dialog-error';
630 break;
631 case self::STATUS_ICON_WARNING:
632 $icon = 'status-dialog-warning';
633 break;
634 case self::STATUS_ICON_NOTIFICATION:
635 $icon = 'status-dialog-notification';
636 break;
637 case self::STATUS_ICON_OK:
638 $icon = 'status-dialog-ok';
639 break;
640 default:
641 // Do nothing
642 }
643 if ($icon != '') {
644 return $this->iconFactory->getIcon($icon, Icon::SIZE_SMALL)->render();
645 }
646 return '';
647 }
648
649 /**
650 * Returns JavaScript variables setting the returnUrl and thisScript location for use by JavaScript on the page.
651 * Used in fx. db_list.php (Web>List)
652 *
653 * @param string $thisLocation URL to "this location" / current script
654 * @return string Urls are returned as JavaScript variables T3_RETURN_URL and T3_THIS_LOCATION
655 * @see typo3/db_list.php
656 * @internal
657 */
658 public function redirectUrls($thisLocation = '')
659 {
660 $thisLocation = $thisLocation ? $thisLocation : GeneralUtility::linkThisScript([
661 'CB' => '',
662 'SET' => '',
663 'cmd' => '',
664 'popViewId' => ''
665 ]);
666 $out = '
667 var T3_RETURN_URL = ' . GeneralUtility::quoteJSvalue(str_replace('%20', '', rawurlencode(GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'))))) . ';
668 var T3_THIS_LOCATION = ' . GeneralUtility::quoteJSvalue(str_replace('%20', '', rawurlencode($thisLocation))) . '
669 ';
670 return $out;
671 }
672
673 /**
674 * Returns the header-bar in the top of most backend modules
675 * Closes section if open.
676 *
677 * @param string $text The text string for the header
678 * @return string HTML content
679 * @internal
680 */
681 public function header($text)
682 {
683 return '
684
685 <!-- MAIN Header in page top -->
686 <h1 class="t3js-title-inlineedit">' . htmlspecialchars($text) . '</h1>
687 ';
688 }
689
690 /**
691 * Creates a Message object and adds it to the FlashMessageQueue.
692 *
693 * @param string $messageBody The message
694 * @param string $messageTitle Optional message title
695 * @param int $severity Optional severity, must be one of \TYPO3\CMS\Core\Messaging\FlashMessage constants
696 * @param bool $storeInSession Optional, defines whether the message should be stored in the session (default)
697 * @throws \InvalidArgumentException if the message body is no string
698 * @return self
699 */
700 public function addFlashMessage($messageBody, $messageTitle = '', $severity = AbstractMessage::OK, $storeInSession = true): self
701 {
702 if (!is_string($messageBody)) {
703 throw new \InvalidArgumentException('The message body must be of type string, "' . gettype($messageBody) . '" given.', 1446483133);
704 }
705 /* @var \TYPO3\CMS\Core\Messaging\FlashMessage $flashMessage */
706 $flashMessage = GeneralUtility::makeInstance(
707 \TYPO3\CMS\Core\Messaging\FlashMessage::class,
708 $messageBody,
709 $messageTitle,
710 $severity,
711 $storeInSession
712 );
713 $this->getFlashMessageQueue()->enqueue($flashMessage);
714 return $this;
715 }
716
717 /**
718 * @param \TYPO3\CMS\Core\Messaging\FlashMessageQueue $flashMessageQueue
719 * @return self
720 */
721 public function setFlashMessageQueue($flashMessageQueue): self
722 {
723 $this->flashMessageQueue = $flashMessageQueue;
724 return $this;
725 }
726
727 /**
728 * @return \TYPO3\CMS\Core\Messaging\FlashMessageQueue
729 */
730 protected function getFlashMessageQueue()
731 {
732 if (!isset($this->flashMessageQueue)) {
733 /** @var FlashMessageService $service */
734 $service = GeneralUtility::makeInstance(FlashMessageService::class);
735 $this->flashMessageQueue = $service->getMessageQueueByIdentifier();
736 }
737 return $this->flashMessageQueue;
738 }
739
740 /**
741 * @return bool
742 */
743 public function isUiBlock(): bool
744 {
745 return $this->uiBlock;
746 }
747
748 /**
749 * @param bool $uiBlock
750 * @return self
751 */
752 public function setUiBlock(bool $uiBlock): self
753 {
754 $this->uiBlock = $uiBlock;
755 return $this;
756 }
757 }