MakeSlugViewHelper¶
ViewHelper to render slug for requested route
Properties¶
| Name: | Type: | Description: | 
|---|---|---|
| for | string | Route name | 
| with | array | Route parameters | 
Example¶
demo_clients-show:
   path:       api/demo/clients/{client}
   controller: Vendor\Demo\Controller\ClientApiController::show
   defaults:
     plugin:   ClientApi
{namespace route = LMS\Routes\ViewHelpers}
<a href="{route:makeSlug( for: 'demo_clients-show', with: {client: 2} )}">
   Show
</a>
// or initialize a JS constant
<script type="text/javascript">
   const showClientUrl = "{route:makeSlug( for: 'demo_clients-show', with: {client: 2} )}";
</script>
Output:
api/demo/clients/2