added link_to_action method to html class.

This commit is contained in:
Taylor Otwell 2012-02-24 08:08:56 -06:00
parent d6fba0ade1
commit 9019c6e2f6
1 changed files with 24 additions and 0 deletions

View File

@ -180,6 +180,30 @@ public static function link_to_route($name, $title, $parameters = array(), $attr
return static::link(URL::to_route($name, $parameters), $title, $attributes);
}
/**
* Generate an HTML link to a controller action.
*
* An array of parameters may be specified to fill in URI segment wildcards.
*
* <code>
* // Generate a link to the "home@index" action
* echo HTML::link_to_action('home@index', 'Home');
*
* // Generate a link to the "user@profile" route and add some parameters
* echo HTML::link_to_action('user@profile', 'Profile', array('taylor'));
* </code>
*
* @param string $action
* @param string $title
* @param array $parameters
* @param array $attributes
* @return string
*/
public static function link_to_action($action, $title, $parameters = array(), $attributes = array())
{
return static::link(URL::to_action($action, $parameters), $title, $attributes);
}
/**
* Generate an HTML mailto link.
*