/**
  * Checks if getData() works with type "data:page"
  *
  * @test
  */
 public function getDataWithTypeDebugPage()
 {
     $uid = rand();
     $GLOBALS['TSFE']->page = array('uid' => $uid);
     $expectedResult = 'array(1item)uid=>' . $uid . '(integer)';
     $result = $this->subject->getData('debug:page');
     $cleanedResult = strip_tags($result);
     $cleanedResult = str_replace("\r", '', $cleanedResult);
     $cleanedResult = str_replace("\n", '', $cleanedResult);
     $cleanedResult = str_replace("\t", '', $cleanedResult);
     $cleanedResult = str_replace(' ', '', $cleanedResult);
     $this->assertEquals($expectedResult, $cleanedResult);
 }
示例#2
0
 /**
  * Process content object data
  *
  * @param ContentObjectRenderer $cObj The data of the content element or page
  * @param array $contentObjectConfiguration The configuration of Content Object
  * @param array $processorConfiguration The configuration of this processor
  * @param array $processedData Key/value store of processed data (e.g. to be passed to a Fluid View)
  * @return array the processed data as key/value store
  */
 public function process(ContentObjectRenderer $cObj, array $contentObjectConfiguration, array $processorConfiguration, array $processedData)
 {
     $siteRootPageId = $cObj->getData('leveluid:0');
     $processedData['siteRootPageId'] = $siteRootPageId;
     return $processedData;
 }
示例#3
0
 /**
  * Check if extension detail view or page properties should be used
  *
  * @param $tables
  * @param \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $cObj
  * @param bool $checkOnly
  * @return array|bool
  */
 public static function getCurrentTable($tables, $cObj, $checkOnly = false)
 {
     foreach ($tables as $key => $table) {
         if (isset($tables[$key . '.']['enable'])) {
             $settings = $tables[$key . '.'];
             $uid = intval($cObj->getData($settings['enable']));
             if ($uid) {
                 if ($checkOnly) {
                     return true;
                 }
                 $data = array('table' => $table, 'uid' => $uid);
                 if (isset($settings['fallback.']) && count($settings['fallback.']) > 0) {
                     $data['fallback'] = $settings['fallback.'];
                 }
                 return $data;
             }
         }
     }
     // page
     $pagesTable = $GLOBALS['TSFE']->sys_language_uid > 0 ? 'pages_language_overlay' : 'pages';
     if (in_array($pagesTable, $tables)) {
         $pageUid = $GLOBALS['TSFE']->page['_PAGES_OVERLAY_UID'] ?: $GLOBALS['TSFE']->id;
         return array($pagesTable, $pageUid);
     }
     return false;
 }