ScriptUrl
extends AbstractHelper
in package
Url view helper for use inside javascript code.
Usage: $this->scriptUrl()->requireUrl('/url/route');.
Table of Contents
Properties
- $urls : array<string, string>
- Array of all urls to make available.
Methods
- __invoke() : ScriptUrl
- getUrls() : array<string, string>
- Returns the list of urls to feed to the javascript url helper.
- requireUrl() : ScriptUrl
- Makes an url route available to the javascript url helper.
- requireUrls() : ScriptUrl
- Make multiple url routes available to the javascript url helper.
Properties
$urls
Array of all urls to make available.
protected
array<string, string>
$urls
= []
Methods
__invoke()
public
__invoke() : ScriptUrl
Return values
ScriptUrlgetUrls()
Returns the list of urls to feed to the javascript url helper.
public
getUrls() : array<string, string>
Return values
array<string, string>requireUrl()
Makes an url route available to the javascript url helper.
public
requireUrl(string $name[, array<string|int, string> $params = [] ]) : ScriptUrl
Parameters
- $name : string
-
name of the route
- $params : array<string|int, string> = []
-
list of route parameters to make available
Return values
ScriptUrlrequireUrls()
Make multiple url routes available to the javascript url helper.
public
requireUrls(array<string|int, string> $names, array<string|int, string> $params) : ScriptUrl
Only works with urls which have the same parameters.
Parameters
- $names : array<string|int, string>
-
list of route names
- $params : array<string|int, string>
-
list of route parameters to make available