예제 #1
0
 /**
  * Fill the button lists with the defined HTML
  *
  * @param array $buttons HTML for all buttons
  * @return array Containing HTML for both buttonlists
  */
 protected function getDocHeaderButtons($buttons)
 {
     $markers = array();
     // Fill buttons for left and right float
     $floats = array('left', 'right');
     foreach ($floats as $key) {
         // Get the template for each float
         $buttonTemplate = $this->templateService->getSubpart($this->moduleTemplate, '###BUTTON_GROUPS_' . strtoupper($key) . '###');
         // Fill the button markers in this float
         $buttonTemplate = $this->templateService->substituteMarkerArray($buttonTemplate, $buttons, '###|###', true);
         // getting the wrap for each group
         $buttonWrap = $this->templateService->getSubpart($this->moduleTemplate, '###BUTTON_GROUP_WRAP###');
         // looping through the groups (max 6) and remove the empty groups
         for ($groupNumber = 1; $groupNumber < 6; $groupNumber++) {
             $buttonMarker = '###BUTTON_GROUP' . $groupNumber . '###';
             $buttonGroup = $this->templateService->getSubpart($buttonTemplate, $buttonMarker);
             if (trim($buttonGroup)) {
                 if ($buttonWrap) {
                     $buttonGroup = $this->templateService->substituteMarker($buttonWrap, '###BUTTONS###', $buttonGroup);
                 }
                 $buttonTemplate = $this->templateService->substituteSubpart($buttonTemplate, $buttonMarker, trim($buttonGroup));
             }
         }
         // Replace the marker with the template and remove all line breaks (for IE compat)
         $markers['BUTTONLIST_' . strtoupper($key)] = str_replace(LF, '', $buttonTemplate);
     }
     // Hook for manipulating docHeaderButtons
     if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['docHeaderButtonsHook'])) {
         $params = array('buttons' => $buttons, 'markers' => &$markers, 'pObj' => &$this);
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['docHeaderButtonsHook'] as $funcRef) {
             GeneralUtility::callUserFunction($funcRef, $params, $this);
         }
     }
     return $markers;
 }
예제 #2
0
 /**
  * Substitutes a marker string in the input content
  * (by a simple str_replace())
  *
  * @param string $content The content stream, typically HTML template content.
  * @param string $marker The marker string, typically on the form "###[the marker string]###
  * @param mixed $markContent The content to insert instead of the marker string found.
  * @return string The processed HTML content string.
  * @see substituteSubpart()
  */
 public function substituteMarker($content, $marker, $markContent)
 {
     return $this->templateService->substituteMarker($content, $marker, $markContent);
 }
 /**
  * @dataProvider substituteMarkerDataProvider
  * @param string $content The content stream, typically HTML template content.
  * @param string $marker The marker string, typically on the form "###[the marker string]###
  * @param mixed $markContent The content to insert instead of the marker string found.
  * @param string $expected The expected result of the substitution
  */
 public function substituteMarker($content, $marker, $markContent, $expected)
 {
     $this->assertSame($expected, $this->templateService->substituteMarker($content, $marker, $markContent));
 }