$label =
$arguments[1
];
$variables =
$arguments[2
] ?? null;
$lineno =
$label->
getTemplateLine();
if ($label instanceof ConstantExpression
) { // If the label argument is given as a constant, we can either
// strip it away if it is empty, or integrate it into the array
// of variables at compile time.
$labelIsExpression = false;
// Only insert the label into the array if it is not empty
if (!
twig_test_empty($label->
getAttribute('value'
))) { $originalVariables =
$variables;
$variables =
new ArrayExpression([],
$lineno);
$labelKey =
new ConstantExpression('label',
$lineno);
if (null !==
$originalVariables) { foreach ($originalVariables->
getKeyValuePairs() as $pair) { // Don't copy the original label attribute over if it exists
if ((string) $labelKey !==
(string) $pair['key'
]) { $variables->
addElement($pair['value'
],
$pair['key'
]);
} } }