Skip to content

CollectionUrl

The CollectionUrl object extended the Url object and represents the link to the collection.

classDiagram
  direction LR
  CollectionUrl <|-- Url
  class Url{
  }
  class CollectionUrl{
    int collectionId
    string collectionName
    array params
    CollectionUrl forPage(int page)
    CollectionUrl forView(string view)
    CollectionUrl forSort(int sort)
  }

Methods

url.forPage(int page)

CollectionUrl by calling this method you set the page parameter to the url

source
{{ url.forPage(2) }}
output
/en/collection/Our-new-brand/45/2 

url.forView(string view)

CollectionUrl by calling this method you set the view parameter to the url

source
{{ url.forView('special') }}
output
/en/collection/Our-new-brand/45/1/special 

url.forSort(int sort)

CollectionUrl by calling this method you set the sort parameter to the url

source
{{ url.forSort(2) }}
output
/en/collection/Our-new-brand/45/1/default/2

Examples

The forPage(), forView() and forSort() methods return the object so you can call relative or absolute properties on it

source
{{ url.forPage(2).absolute }}
output
https://example.com/en/collection/Our-new-brand/45/2

You can also call those methods in chain and create the url as you like

source
{{ url.forPage(3).forView('special').forSort(5).relative }}
output
/en/collection/Our-new-brand/45/3/special/5