protected function addOptionDefaults(array &
$options) { $request =
$this->requestStack->
getCurrentRequest();
$current_base_path =
$request->
getBasePath() . '/';
$current_script_path = '';
$base_path_with_script =
$request->
getBaseUrl();
// If the current request was made with the script name (eg, index.php) in
// it, then extract it, making sure the leading / is gone, and a trailing /
// is added, to allow simple string concatenation with other parts.
if (!
empty($base_path_with_script)) { $script_name =
$request->
getScriptName();
if (str_contains($base_path_with_script,
$script_name)) { $current_script_path =
ltrim(substr($script_name,
strlen($current_base_path)), '/'
) . '/';
} } // Merge in defaults.
$options +=
[ 'fragment' => '',
'query' =>
[],
'absolute' => FALSE,
'prefix' => '',