Added ability to dynamically create links to named routes using the HTML class.
This commit is contained in:
parent
b90c6ddcc5
commit
6af79d8bdb
|
@ -76,6 +76,34 @@ public static function link_to_asset($url, $title, $attributes = array())
|
||||||
return static::link($url, $title, $attributes, false, true);
|
return static::link($url, $title, $attributes, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate an HTML link to a route.
|
||||||
|
*
|
||||||
|
* @param string $name
|
||||||
|
* @param string $title
|
||||||
|
* @param array $parameters
|
||||||
|
* @param array $attributes
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function link_to_route($name, $title, $parameters = array(), $attributes = array(), $https = false)
|
||||||
|
{
|
||||||
|
return static::link(URL::to_route($name, $parameters, $https), $title, $attributes);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate an HTTPS HTML link to a route.
|
||||||
|
*
|
||||||
|
* @param string $name
|
||||||
|
* @param string $title
|
||||||
|
* @param array $parameters
|
||||||
|
* @param array $attributes
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function link_to_secure_route($name, $title, $parameters = array(), $attributes = array())
|
||||||
|
{
|
||||||
|
return static::link_to_route($name, $title, $parameters, $attributes, true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate an HTML mailto link.
|
* Generate an HTML mailto link.
|
||||||
*
|
*
|
||||||
|
@ -250,4 +278,28 @@ public static function obfuscate($value)
|
||||||
return $safe;
|
return $safe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Magic Method for handling dynamic static methods.
|
||||||
|
*/
|
||||||
|
public static function __callStatic($method, $parameters)
|
||||||
|
{
|
||||||
|
// -------------------------------------------------------
|
||||||
|
// Handle the dynamic creation of links to secure routes.
|
||||||
|
// -------------------------------------------------------
|
||||||
|
if (strpos($method, 'link_to_secure_') === 0)
|
||||||
|
{
|
||||||
|
array_unshift($parameters, substr($method, 15));
|
||||||
|
return forward_static_call_array('HTML::link_to_secure_route', $parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------
|
||||||
|
// Handle the dynamic creation of links to routes.
|
||||||
|
// -------------------------------------------------------
|
||||||
|
if (strpos($method, 'link_to_') === 0)
|
||||||
|
{
|
||||||
|
array_unshift($parameters, substr($method, 8));
|
||||||
|
return forward_static_call_array('HTML::link_to_route', $parameters);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue