getInternalArgument() 공개 메소드

Internal arguments are set via setArgument(). In order to be handled as an internal argument, its name must start with two underscores.
public getInternalArgument ( string $argumentName ) : string
$argumentName string Name of the argument, for example "__fooBar"
리턴 string Value of the argument, or NULL if not set.
예제 #1
0
파일: FormRuntime.php 프로젝트: neos/form
 /**
  * @return void
  * @internal
  */
 protected function initializeCurrentPageFromRequest()
 {
     if (!$this->formState->isFormSubmitted()) {
         $this->currentPage = $this->formDefinition->getPageByIndex(0);
         return;
     }
     $this->lastDisplayedPage = $this->formDefinition->getPageByIndex($this->formState->getLastDisplayedPageIndex());
     // We know now that lastDisplayedPage is filled
     $currentPageIndex = (int) $this->request->getInternalArgument('__currentPage');
     if ($currentPageIndex > $this->lastDisplayedPage->getIndex() + 1) {
         // We only allow jumps to following pages
         $currentPageIndex = $this->lastDisplayedPage->getIndex() + 1;
     }
     // We now know that the user did not try to skip a page
     if ($currentPageIndex === count($this->formDefinition->getPages())) {
         // Last Page
         $this->currentPage = null;
     } else {
         $this->currentPage = $this->formDefinition->getPageByIndex($currentPageIndex);
     }
 }
 /**
  * @test
  */
 public function internalArgumentsMayHaveObjectValues()
 {
     $someObject = new \stdClass();
     $this->actionRequest->setArgument('__someInternalArgument', $someObject);
     $this->assertSame($someObject, $this->actionRequest->getInternalArgument('__someInternalArgument'));
 }
 /**
  * Initialize the property mapping configuration in $controllerArguments if
  * the trusted properties are set inside the request.
  *
  * @param ActionRequest $request
  * @param Arguments $controllerArguments
  * @return void
  */
 public function initializePropertyMappingConfigurationFromRequest(ActionRequest $request, Arguments $controllerArguments)
 {
     $trustedPropertiesToken = $request->getInternalArgument('__trustedProperties');
     if (!is_string($trustedPropertiesToken)) {
         return;
     }
     $serializedTrustedProperties = $this->hashService->validateAndStripHmac($trustedPropertiesToken);
     $trustedProperties = unserialize($serializedTrustedProperties);
     foreach ($trustedProperties as $propertyName => $propertyConfiguration) {
         if (!$controllerArguments->hasArgument($propertyName)) {
             continue;
         }
         $propertyMappingConfiguration = $controllerArguments->getArgument($propertyName)->getPropertyMappingConfiguration();
         $this->modifyPropertyMappingConfiguration($propertyConfiguration, $propertyMappingConfiguration);
     }
 }