示例#1
0
 /**
  * Put together the various elements for the module <body> using a static HTML
  * template
  *
  * @param array $pageRecord Record of the current page, used for page path and info
  * @param array $buttons HTML for all buttons
  * @param array $markerArray HTML for all other markers
  * @param array $subpartArray HTML for the subparts
  * @return string Composite HTML
  */
 public function moduleBody($pageRecord = array(), $buttons = array(), $markerArray = array(), $subpartArray = array())
 {
     // Get the HTML template for the module
     $moduleBody = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($this->moduleTemplate, '###FULLDOC###');
     // Add CSS
     $this->inDocStylesArray[] = 'html { overflow: hidden; }';
     // Get the page path for the docheader
     $markerArray['PAGEPATH'] = $this->getPagePath($pageRecord);
     // Get the page info for the docheader
     $markerArray['PAGEINFO'] = $this->getPageInfo($pageRecord);
     // Get all the buttons for the docheader
     $docHeaderButtons = $this->getDocHeaderButtons($buttons);
     // Merge docheader buttons with the marker array
     $markerArray = array_merge($markerArray, $docHeaderButtons);
     // replacing subparts
     foreach ($subpartArray as $marker => $content) {
         $moduleBody = \TYPO3\CMS\Core\Html\HtmlParser::substituteSubpart($moduleBody, $marker, $content);
     }
     // adding flash messages
     if ($this->showFlashMessages) {
         $flashMessages = \TYPO3\CMS\Core\Messaging\FlashMessageQueue::renderFlashMessages();
         if (!empty($flashMessages)) {
             $markerArray['FLASHMESSAGES'] = '<div id="typo3-messages">' . $flashMessages . '</div>';
             // If there is no dedicated marker for the messages present
             // then force them to appear before the content
             if (strpos($moduleBody, '###FLASHMESSAGES###') === FALSE) {
                 $moduleBody = str_replace('###CONTENT###', '###FLASHMESSAGES######CONTENT###', $moduleBody);
             }
         }
     }
     // Hook for adding more markers/content to the page, like the version selector
     if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['moduleBodyPostProcess'])) {
         $params = array('moduleTemplateFilename' => &$this->moduleTemplateFilename, 'moduleTemplate' => &$this->moduleTemplate, 'moduleBody' => &$moduleBody, 'markers' => &$markerArray, 'parentObject' => &$this);
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['moduleBodyPostProcess'] as $funcRef) {
             \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
         }
     }
     // Replacing all markers with the finished markers and return the HTML content
     return \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($moduleBody, $markerArray, '###|###');
 }