PHP Class Bolt\Controller\Frontend

This file acts as a grouping for the default front-end controllers. For overriding the default behavior here, please reference https://docs.bolt.cm/templating/templates-routes#routing or the routing.yml file in your configuration.
Inheritance: extends ConfigurableBase
Show file Open project: bolt/bolt Class Usage Examples

Public Methods

Method Description
after ( Request $request, Response $response )
before ( Request $request ) : null | TemplateResponse | RedirectResponse The default before filter for the controllers in this file.
homepage ( Request $request ) : TemplateResponse Controller for the "Homepage" route. Usually the front page of the website.
listing ( Request $request, string $contenttypeslug ) : TemplateResponse The listing page controller.
preview ( Request $request, string $contenttypeslug ) : TemplateResponse The controller for previewing a content from posted data.
record ( Request $request, string $contenttypeslug, string $slug = '' ) : TemplateResponse Controller for a single record page, like '/page/about/' or '/entry/lorum'.
search ( Request $request, array $contenttypes = null ) : TemplateResponse The search result page controller.
taxonomy ( Request $request, string $taxonomytype, string $slug ) : TemplateResponse | false The taxonomy listing page controller.
template ( string $template ) : TemplateResponse Renders the specified template from the current theme in response to a request without loading any content.

Protected Methods

Method Description
addRoutes ( Silex\ControllerCollection $c )
getConfigurationRoutes ( )
isTaxonomyValid ( Content $content, string $slug, array $taxonomy ) : boolean Check if the taxonomy is valid.

Private Methods

Method Description
getListingOrder ( array $contentType ) : null | string Return the listing order.
getListingParameters ( string $contentTypeSlug ) : array Returns an array of the parameters used in getContent for listing pages.

Method Details

addRoutes() protected method

protected addRoutes ( Silex\ControllerCollection $c )
$c Silex\ControllerCollection

after() public method

public after ( Request $request, Response $response )
$request Symfony\Component\HttpFoundation\Request
$response Symfony\Component\HttpFoundation\Response

before() public method

Refer to the routing.yml config file for overridding.
public before ( Request $request ) : null | TemplateResponse | RedirectResponse
$request Symfony\Component\HttpFoundation\Request The Symfony Request
return null | Bolt\Response\TemplateResponse | Symfony\Component\HttpFoundation\RedirectResponse

getConfigurationRoutes() protected method

protected getConfigurationRoutes ( )

homepage() public method

Controller for the "Homepage" route. Usually the front page of the website.
public homepage ( Request $request ) : TemplateResponse
$request Symfony\Component\HttpFoundation\Request
return Bolt\Response\TemplateResponse

isTaxonomyValid() protected method

Check if the taxonomy is valid.
See also: https://github.com/bolt/bolt/pull/2310
protected isTaxonomyValid ( Content $content, string $slug, array $taxonomy ) : boolean
$content Bolt\Legacy\Content
$slug string
$taxonomy array
return boolean

listing() public method

The listing page controller.
public listing ( Request $request, string $contenttypeslug ) : TemplateResponse
$request Symfony\Component\HttpFoundation\Request The Symfony Request
$contenttypeslug string The content type slug
return Bolt\Response\TemplateResponse

preview() public method

The controller for previewing a content from posted data.
public preview ( Request $request, string $contenttypeslug ) : TemplateResponse
$request Symfony\Component\HttpFoundation\Request The Symfony Request
$contenttypeslug string The content type slug
return Bolt\Response\TemplateResponse

record() public method

Controller for a single record page, like '/page/about/' or '/entry/lorum'.
public record ( Request $request, string $contenttypeslug, string $slug = '' ) : TemplateResponse
$request Symfony\Component\HttpFoundation\Request The request
$contenttypeslug string The content type slug
$slug string The content slug
return Bolt\Response\TemplateResponse

taxonomy() public method

The taxonomy listing page controller.
public taxonomy ( Request $request, string $taxonomytype, string $slug ) : TemplateResponse | false
$request Symfony\Component\HttpFoundation\Request The Symfony Request
$taxonomytype string The taxonomy type slug
$slug string The taxonomy slug
return Bolt\Response\TemplateResponse | false

template() public method

Renders the specified template from the current theme in response to a request without loading any content.
public template ( string $template ) : TemplateResponse
$template string The template name
return Bolt\Response\TemplateResponse