/**
  * @dataProvider structureStringIsParsedDataProvider
  * @test
  */
 public function getCurrentStructureDomObjectIdPrefixReturnsExceptedStringAfterInitializationByStructureString($string, array $_, array $expectedFormName)
 {
     /** @var InlineStackProcessor|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface $subject */
     $subject = new InlineStackProcessor();
     $subject->initializeByParsingDomObjectIdString($string);
     $this->assertEquals($expectedFormName['object'], $subject->getCurrentStructureDomObjectIdPrefix('pageId'));
 }
Exemple #2
0
 /**
  * General processor for AJAX requests concerning IRRE.
  *
  * @param array $_ Additional parameters (not used here)
  * @param AjaxRequestHandler $ajaxObj The AjaxRequestHandler object of this request
  * @throws \RuntimeException
  * @return void
  */
 public function processInlineAjaxRequest($_, AjaxRequestHandler $ajaxObj)
 {
     $ajaxArguments = GeneralUtility::_GP('ajax');
     $ajaxIdParts = explode('::', $GLOBALS['ajaxID'], 2);
     if (isset($ajaxArguments) && is_array($ajaxArguments) && count($ajaxArguments)) {
         $ajaxMethod = $ajaxIdParts[1];
         $ajaxObj->setContentFormat('jsonbody');
         // Construct runtime environment for Inline Relational Record Editing
         $this->setUpRuntimeEnvironmentForAjaxRequests();
         // @todo: ajaxArguments[2] is "returnUrl" in the first 3 calls - still needed?
         switch ($ajaxMethod) {
             case 'synchronizeLocalizeRecords':
                 $domObjectId = $ajaxArguments[0];
                 $type = $ajaxArguments[1];
                 // Parse the DOM identifier (string), add the levels to the structure stack (array), load the TCA config:
                 $this->inlineStackProcessor->initializeByParsingDomObjectIdString($domObjectId);
                 $this->inlineStackProcessor->injectAjaxConfiguration($ajaxArguments['context']);
                 $inlineFirstPid = FormEngineUtility::getInlineFirstPidFromDomObjectId($domObjectId);
                 $ajaxObj->setContent($this->renderInlineSynchronizeLocalizeRecords($type, $inlineFirstPid));
                 break;
             case 'createNewRecord':
                 $domObjectId = $ajaxArguments[0];
                 $createAfterUid = 0;
                 if (isset($ajaxArguments[1])) {
                     $createAfterUid = $ajaxArguments[1];
                 }
                 // Parse the DOM identifier (string), add the levels to the structure stack (array), load the TCA config:
                 $this->inlineStackProcessor->initializeByParsingDomObjectIdString($domObjectId);
                 $this->inlineStackProcessor->injectAjaxConfiguration($ajaxArguments['context']);
                 $ajaxObj->setContent($this->renderInlineNewChildRecord($domObjectId, $createAfterUid));
                 break;
             case 'getRecordDetails':
                 $domObjectId = $ajaxArguments[0];
                 // Parse the DOM identifier (string), add the levels to the structure stack (array), load the TCA config:
                 $this->inlineStackProcessor->initializeByParsingDomObjectIdString($domObjectId);
                 $this->inlineStackProcessor->injectAjaxConfiguration($ajaxArguments['context']);
                 $ajaxObj->setContent($this->renderInlineChildRecord($domObjectId));
                 break;
             case 'setExpandedCollapsedState':
                 $domObjectId = $ajaxArguments[0];
                 // Parse the DOM identifier (string), add the levels to the structure stack (array), don't load TCA config
                 $this->inlineStackProcessor->initializeByParsingDomObjectIdString($domObjectId, FALSE);
                 $expand = $ajaxArguments[1];
                 $collapse = $ajaxArguments[2];
                 $this->setInlineExpandedCollapsedState($expand, $collapse);
                 break;
             default:
                 throw new \RuntimeException('Not a valid ajax identifier', 1428227862);
         }
     }
 }