Cms\Helpers\Cms

Overview

Cms Helper

See Also

Protected Properties

protected static bool $actionExists

actionExists determines if the run action exists

protected string $urlPathPrefix

urlPathPrefix prefixes every URL


Public Methods

public entryUrl()

public entryUrl($componentName, $parameters = [], $componentProps = null): void

entryUrl returns an entry point URL from the CMS theme based on a component name and the isDefault component property to assign it explicitly.

public flashFromPost()

public flashFromPost($message, $key = 'message'): void

flashFromPost requests a flash message from the "message" postback.

public fullUrl()

public fullUrl($path = null): void

fullUrl returns a complete URL considering the current site context and base URL, including prefix and hostname.

public makeCarbon()

public makeCarbon($value, $throwException = true): Carbon\Carbon 

makeCarbon converts mixed inputs to a Carbon object and sets the CMS timezone

public pageError()

public pageError(): void

pageError returns a 500 page response

public pageNotFound()

public pageNotFound(): void

pageNotFound returns a 404 page response

public pageUrl()

public pageUrl($name, $parameters = []): void

pageUrl returns a URL for a CMS page, this fires up the CMS controller to generate the value for maximum performance.

public redirect()

public redirect($to, $parameters = [], $status = 302): void

redirect creates a new redirect to a CMS page or URL, the second argument contains the CMS page parameters or the status code.

public redirectFromPost()

public redirectFromPost($key = 'redirect'): void

redirectFromPost performs a redirect after an action using a "redirect" postback value. Setting to false or 0 will disable the redirect. This method will only redirect to a relative path for security reasons.

public redirectIntendedFromPost()

public redirectIntendedFromPost($key = 'redirect'): void

public setUrlPrefix()

public setUrlPrefix($prefix): void

setUrlPrefix sets a prefix for every URL

public siteUrl()

public siteUrl($page, $site, $parameters = []): void

siteUrl returns a URL for a CMS page, this is similar to pageUrl except supports a different site context.

public url()

public url($path = null): void

url returns a URL in context of the frontend

public urlHasException()

public urlHasException($url, $type): bool 

urlHasException checks if the url pattern has an exception for the specified type

Protected Methods

protected getPatternFromPage()

protected getPatternFromPage($page, $site): string 

protected getUrlFromPattern()

protected getUrlFromPattern($urlPattern, $page, $site, $parameters): string 

protected makePostRedirect()

protected makePostRedirect($key = 'redirect', $method = 'to'): void

protected withPreservedQueryString()

protected withPreservedQueryString($url, $page, $site): string 

withPreservedQueryString makes sure to add any existing query string to the redirect url.