public function restoreTemplateVariables($slotName)
    {
        $templateVariableContainer = $this->renderingContext->getTemplateVariableContainer();
        $mergedArguments = (isset($this->injectedVariables[$slotName])) ? $this->injectedVariables[$slotName] : [];
        $savedArguments = (isset($this->savedVariables[$slotName])) ? $this->savedVariables[$slotName] : [];

        foreach (array_keys($mergedArguments) as $key) {
            $templateVariableContainer->remove($key);
        }

        foreach ($savedArguments as $key => $value) {
            $templateVariableContainer->add($key, $value);
        }
    }
public function restoreTemplateVariables($slotName)
    {
        $templateVariableContainer = $this->renderingContext->getTemplateVariableContainer();
        $mergedArguments = (isset($this->injectedVariables[$slotName])) ? $this->injectedVariables[$slotName] : [];
        $savedArguments = (isset($this->savedVariables[$slotName])) ? $this->savedVariables[$slotName] : [];

        foreach (array_keys($mergedArguments) as $key) {
            $templateVariableContainer->remove($key);
        }

        foreach ($savedArguments as $key => $value) {
            $templateVariableContainer->add($key, $value);
        }
    }
public function restoreTemplateVariables ( $ slotName ) { $ templateVariableContainer = $ this -> renderingContext -> getTemplateVariableContainer ( ) ; $ mergedArguments = ( isset ( $ this -> injectedVariables [ $ slotName ] ) ) ? $ this -> injectedVariables [ $ slotName ] : [ ] ; $ savedArguments = ( isset ( $ this -> savedVariables [ $ slotName ] ) ) ? $ this -> savedVariables [ $ slotName ] : [ ] ; foreach ( array_keys ( $ mergedArguments ) as $ key ) { $ templateVariableContainer -> remove ( $ key ) ; } foreach ( $ savedArguments as $ key => $ value ) { $ templateVariableContainer -> add ( $ key , $ value ) ; } }
Will remove all variables previously injected in the template variable
container, and restore the ones that were saved before being overridden.

@param string $slotName
Will remove all variables previously injected in the template variable container and restore the ones that were saved before being overridden .