/**
  * @param Request $request
  * @param RenderingContext $renderingContext
  * @return array
  */
 protected function resolveRenderingConfiguration(Request $request, RenderingContext $renderingContext)
 {
     $configuration = array();
     if ($request->hasArgument('path')) {
         $renderingPath = $request->getArgument('path');
     }
     if ($request->hasArgument('record')) {
         if (strpos($request->getArgument('record'), '_') !== FALSE) {
             list($table, $id) = GeneralUtility::revExplode('_', $request->getArgument('record'), 2);
         } else {
             $id = $request->getArgument('record');
         }
     }
     if ($request->hasArgument('table')) {
         $table = $request->getArgument('table');
     }
     if (empty($table) && empty($id)) {
         $table = 'pages';
         $id = $renderingContext->getFrontendController()->id;
         if (!empty($id) && $renderingContext->getFrontendController()->page['pid'] === '0') {
             // Allow rendering of a root page which has pid === 0 and will be denied otherwise
             $configuration['dontCheckPid'] = '1';
         }
     }
     if (!empty($id) && empty($table)) {
         $table = 'tt_content';
     }
     $configuration['source'] = $table . '_' . $id;
     $configuration['tables'] = $table;
     if (!empty($renderingPath)) {
         $configuration['conf.'][$table] = '< ' . $renderingPath;
     }
     return $configuration;
 }
 /**
  * Resolves the table name and uid for the record the rendering is based upon.
  * Falls back to current page if none is available
  *
  * @param $contextRecord
  * @return array table name as first and uid as second index of the array
  *
  * @throws ConfigurationBuildingException
  */
 protected function resolveTableNameAndUidFromContextString($contextRecord)
 {
     if (!is_string($contextRecord)) {
         throw new ConfigurationBuildingException(sprintf('Context record must be of type string "%s" given.', gettype($contextRecord)), 1416846201);
     }
     if ($contextRecord === 'currentPage') {
         $tableNameAndUid = array('pages', $this->renderingContext->getFrontendController()->id);
     } else {
         $tableNameAndUid = explode(':', $contextRecord);
         if (count($tableNameAndUid) !== 2 || empty($tableNameAndUid[0]) || empty($tableNameAndUid[1]) || !MathUtility::canBeInterpretedAsInteger($tableNameAndUid[1])) {
             $tableNameAndUid = array('pages', $this->renderingContext->getFrontendController()->id);
         }
     }
     // TODO: maybe check if the record is available
     return $tableNameAndUid;
 }
 /**
  * @param Request $request
  * @param RenderingContext $renderingContext
  * @return array
  */
 protected function resolveRenderingConfiguration(Request $request, RenderingContext $renderingContext)
 {
     $configuration = array();
     if ($request->hasArgument('path')) {
         $renderingPath = $request->getArgument('path');
     }
     if ($request->hasArgument('record')) {
         if (strpos($request->getArgument('record'), '_') !== FALSE) {
             list($table, $id) = GeneralUtility::revExplode('_', $request->getArgument('record'), 2);
         } else {
             $id = $request->getArgument('record');
         }
     }
     if ($request->hasArgument('table')) {
         $table = $request->getArgument('table');
     }
     if (empty($table) && empty($id)) {
         $table = 'pages';
         $id = $renderingContext->getFrontendController()->id;
     }
     if (!empty($id) && empty($table)) {
         $table = 'tt_content';
     }
     if ($table === 'pages') {
         // Allow rendering of a root page which has pid === 0 and would be denied otherwise
         $rootLine = $renderingContext->getFrontendController()->sys_page->getRootLine($id);
         // $rootLine[0] is the root page. Check if the page we're going to render is a root page.
         // We explicitly ignore the case where the to be rendered id is in another root line (multi domain setup)
         // as this would require an additional record lookup. The use case for this is very limited anyway
         // and should be implemented in a different renderer instead of covering that here.
         if ($rootLine[0]['uid'] === (string) $id) {
             $configuration['dontCheckPid'] = '1';
         }
     }
     $configuration['source'] = $table . '_' . $id;
     $configuration['tables'] = $table;
     if (!empty($renderingPath)) {
         $configuration['conf.'][$table] = '< ' . $renderingPath;
     }
     return $configuration;
 }