Skip to main content

Routes

Routes within Photon are based on the Symfony router.

Where a {placeholder} is placed in the route path, that portion becomes a wildcard. The corresponding controller must now have an argument called $placeholder.

note

The wildcard and argument names must match exactly.

note

Each route has an internal name. For example homepage, atoz_list and atoz_article. These must be unique and are used to generate URLs in controllers and templates.

Further information on routing is available in the Symfony documentation - Routing.

Routes are defined in the theme routing.yml config file.

homepage:
path: /homepage/{homepageId}/{homepageSlug}
defaults:
_controller: photon.page.homepage

atoz_list:
path: /a_to_z/{startsWith}
defaults:
_controller: photon.page.atoz_list
startsWith: ~

atoz_article:
path: /a_to_z/service/{serviceId}/{serviceSlug}
defaults:
_controller: photon.page.atoz_article
requirements:
serviceId: \d+