Development

#6051 (link_to2 with sf_format when the third parameter, $param was objecdt)

You must first sign up to be able to contribute.

Ticket #6051 (new defect)

Opened 4 years ago

link_to2 with sf_format when the third parameter, $param was objecdt

Reported by: ganchiku Assigned to: fabien
Priority: minor Milestone:
Component: helpers Version: 1.2.4
Keywords: UrlHelper link_to2 Cc:
Qualification: Unreviewed

Description

Hi,

I was using link_to function with passing object in third parameter, and try to set sf_format as well, but it did not work well. I investigated some code in UrlHelper?.php, and found a problem.

Can you fix the code like follows:

function link_to2($name, $routeName, $params, $options = array())
{
  $params = array_merge(array('sf_route' => $routeName), is_object($params) ? array('sf_subject' => $params) : $params);
  if (array_key_exists('sf_format', $options)) {
    $params = array_merge($params, array('sf_format' => $options['sf_format']));
  }
  return link_to1($name, $params, $options);
}

Thanks