Skip to content

Instantly share code, notes, and snippets.

@bshaffer
Created July 16, 2010 03:33
Show Gist options
  • Save bshaffer/477887 to your computer and use it in GitHub Desktop.
Save bshaffer/477887 to your computer and use it in GitHub Desktop.
<?php
function link_to_current($title, $params = array(), $options = array())
{
$currentRoute = sfContext::getInstance()->getRouting()->getCurrentRouteName();
$currentParams = sfContext::getInstance()->getRequest()->getParameterHolder()->getAll();
unset($currentParams['module'], $currentParams['action']);
$params = array_merge($currentParams, $params);
if (isset($options['query_string']))
{
parse_str($options['query_string'], $extraParams);
$params = array_merge($params, $extraParams);
unset($options['query_string']);
}
$currentRoute = sprintf('@%s?%s', $currentRoute, http_build_query($params));
return link_to1($title, $currentRoute, $options);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment