public function addTemplateVariables($slotName, array $arguments)
    {
        $templateVariableContainer = $this->renderingContext->getTemplateVariableContainer();
        $savedArguments = [];

        ArrayUtility::mergeRecursiveWithOverrule(
            $arguments,
            $this->getSlotArguments($slotName)
        );

        foreach ($arguments as $key => $value) {
            if ($templateVariableContainer->exists($key)) {
                $savedArguments[$key] = $templateVariableContainer->get($key);
                $templateVariableContainer->remove($key);
            }

            $templateVariableContainer->add($key, $value);
        }

        $this->injectedVariables[$slotName] = $arguments;
        $this->savedVariables[$slotName] = $savedArguments;
    }
public function addTemplateVariables($slotName, array $arguments)
    {
        $templateVariableContainer = $this->renderingContext->getTemplateVariableContainer();
        $savedArguments = [];

        ArrayUtility::mergeRecursiveWithOverrule(
            $arguments,
            $this->getSlotArguments($slotName)
        );

        foreach ($arguments as $key => $value) {
            if ($templateVariableContainer->exists($key)) {
                $savedArguments[$key] = $templateVariableContainer->get($key);
                $templateVariableContainer->remove($key);
            }

            $templateVariableContainer->add($key, $value);
        }

        $this->injectedVariables[$slotName] = $arguments;
        $this->savedVariables[$slotName] = $savedArguments;
    }
public function addTemplateVariables ( $ slotName , array $ arguments ) { $ templateVariableContainer = $ this -> renderingContext -> getTemplateVariableContainer ( ) ; $ savedArguments = [ ] ; ArrayUtility :: mergeRecursiveWithOverrule ( $ arguments , $ this -> getSlotArguments ( $ slotName ) ) ; foreach ( $ arguments as $ key => $ value ) { if ( $ templateVariableContainer -> exists ( $ key ) ) { $ savedArguments [ $ key ] = $ templateVariableContainer -> get ( $ key ) ; $ templateVariableContainer -> remove ( $ key ) ; } $ templateVariableContainer -> add ( $ key , $ value ) ; } $ this -> injectedVariables [ $ slotName ] = $ arguments ; $ this -> savedVariables [ $ slotName ] = $ savedArguments ; }
Will merge the given arguments with the ones registered by the given
slot, and inject them in the template variable container.

Note that the variables that are already defined are first saved before
being overridden, so they can be restored later.

@param string $slotName
@param array $arguments
Will merge the given arguments with the ones registered by the given slot and inject them in the template variable container .