Beta version

class DefaultThemeApp extends FrontendController

Class DefaultThemeApp

Constants

AJAX_TOKEN_INTENTION

SCHEMA_TOKEN_INTENTION

FONT_TOKEN_INTENTION

Methods

Request
getRequest()

Shortcut to return the request service.

setContainer(Container $container)

Sets the Container associated with this Controller.

Container
getContainer()

No description

mixed
getService(string|null $key = null)

Get mixed object from Dependency Injection container.

mixed
get(string $serviceName)

Return a service from container.

bool
has(string $serviceName)

Returns true if the service is defined.

AuthorizationChecker
getAuthorizationChecker()

Alias for $this->container['securityAuthorizationChecker'].

TokenStorageInterface
getTokenStorage()

Alias for $this->container['securityTokenStorage'].

EntityManager
em()

Alias for $this->container['em'].

Translator
getTranslator()

No description

Twig_Environment
getTwig()

No description

string
generateUrl(string|NodesSources $route, mixed $parameters = array(), int $referenceType = Router::ABSOLUTE_PATH)

Wrap $this->container['urlGenerator']->generate

RedirectResponse
redirect(string $url, integer $status = Response::HTTP_FOUND)

Returns a RedirectResponse to the given URL.

static string
getCalledClass()

No description

validateAccessForRole(string $role)

Validate a request against a given ROLE_* and throws an AccessDeniedException exception.

RedirectResponse
removeTrailingSlashAction(Request $request)

Custom route for redirecting routes with a trailing slash.

string
renderView(string $view, array $parameters = array())

Returns a rendered view.

Response
render(string $view, array $parameters = array(), Response $response = null, string $namespace = '')

No description

JsonResponse
renderJson(array $data = array(), int $httpStatus = JsonResponse::HTTP_OK)

No description

createEntityListManager(mixed $entity, array $criteria = array(), array $ordering = array())

Creates and returns an EntityListManager instance.

createContactFormManager()

Create and return a ContactFormManager to build and send contact form by email.

createEmailManager()

Create and return a EmailManager to build and send emails.

static string
getThemeName()

No description

static string
getThemeAuthor()

No description

static string
getThemeCopyright()

No description

static string
getThemeDir()

No description

static string
getThemeMainClassName()

No description

static string
getThemeMainClass()

No description

static string
getThemeRequire()

No description

static boolean
isBackendTheme()

No description

__init()

Initialize controller with its twig environment.

static FileLocator
getFileLocator()

Return a file locator with theme Resource folder.

static RouteCollection
getRoutes()

No description

static RouteCollection
getBackendRoutes()

These routes are used to extend Roadiz back-office.

static string
getThemeFolder()

Return theme root folder.

static string
getResourcesFolder()

Return theme Resource folder according to main theme class inheriting AppController.

static string
getViewsFolder()

No description

static string
getTranslationsFolder()

No description

string
getStaticResourcesUrl()

No description

$this
prepareBaseAssignation()

Add a default translation locale for static routes and node SEO data.

Response
throw404(string $message = '')

Return a Response with default backend 404 error page.

getTheme()

Return the current Theme

static 
setupDependencyInjection(Container $container)

No description

publishConfirmMessage(Request $request, string $msg, NodesSources $source = null)

Publish a confirm message in Session flash bag and logger interface.

publishErrorMessage(Request $request, string $msg, NodesSources $source = null)

Publish an error message in Session flash bag and logger interface.

validateNodeAccessForRole(string $role, integer|null $nodeId = null, boolean|false $includeChroot = false)

Validate a request against a given ROLE_* and check chroot and newsletter type/accces and throws an AccessDeniedException exception.

Response
maintenanceAction(Request $request)

No description

Response
indexAction(Request $request, Node $node = null, Translation $translation = null)

Default action for any node URL.

Response
homeAction(Request $request, null $_locale = null)

No description

storeNodeAndTranslation(Node $node = null, Translation $translation = null)

Store current node and translation into controller.

storeNodeSourceAndTranslation(NodesSources $nodeSource = null, Translation $translation = null)

Store current nodeSource and translation into controller.

__initFromOtherController(array $baseAssignation = array(), Container $themeContainer = null)

Initialize controller with environment from an other controller in order to avoid initializing same component again.

array
getNodeSEO(NodesSources $fallbackNodeSource = null)

Get SEO informations for current node.

Details

in Controller at line 72
Request getRequest()

Shortcut to return the request service.

Return Value

Request

in Controller at line 83
ContainerAwareInterface setContainer(Container $container)

Sets the Container associated with this Controller.

Parameters

Container $container

Return Value

ContainerAwareInterface

in Controller at line 92
Container getContainer()

Return Value

Container

in Controller at line 106
mixed getService(string|null $key = null)

Get mixed object from Dependency Injection container.

Alias for $this->container[$key]

Parameters

string|null $key

Return Value

mixed

in Controller at line 114
mixed get(string $serviceName)

Return a service from container.

Parameters

string $serviceName

Return Value

mixed

in Controller at line 122
bool has(string $serviceName)

Returns true if the service is defined.

Parameters

string $serviceName

Return Value

bool true if the service is defined, false otherwise

in Controller at line 132
AuthorizationChecker getAuthorizationChecker()

Alias for $this->container['securityAuthorizationChecker'].

Return Value

AuthorizationChecker

in Controller at line 142
TokenStorageInterface getTokenStorage()

Alias for $this->container['securityTokenStorage'].

Return Value

TokenStorageInterface

in Controller at line 152
EntityManager em()

Alias for $this->container['em'].

Return Value

EntityManager

in Controller at line 160
Translator getTranslator()

Return Value

Translator

in Controller at line 168
Twig_Environment getTwig()

Return Value

Twig_Environment

in Controller at line 182
string generateUrl(string|NodesSources $route, mixed $parameters = array(), int $referenceType = Router::ABSOLUTE_PATH)

Wrap $this->container['urlGenerator']->generate

Parameters

string|NodesSources $route
mixed $parameters
int $referenceType

Return Value

string

in Controller at line 195
RedirectResponse redirect(string $url, integer $status = Response::HTTP_FOUND)

Returns a RedirectResponse to the given URL.

Parameters

string $url
integer $status

Return Value

RedirectResponse

in Controller at line 203
static string getCalledClass()

Return Value

string

in Controller at line 220
validateAccessForRole(string $role)

Validate a request against a given ROLE_* and throws an AccessDeniedException exception.

Parameters

string $role

Exceptions

AccessDeniedException

in Controller at line 234
RedirectResponse removeTrailingSlashAction(Request $request)

Custom route for redirecting routes with a trailing slash.

Parameters

Request $request

Return Value

RedirectResponse

in Controller at line 294
string renderView(string $view, array $parameters = array())

Returns a rendered view.

Parameters

string $view
array $parameters

Return Value

string

in AppController at line 285
Response render(string $view, array $parameters = array(), Response $response = null, string $namespace = '')

Parameters

string $view Template file path
array $parameters Twig assignation array
Response $response Optional Response object to customize response parameters
string $namespace Twig loader namespace

Return Value

Response

Exceptions

Twig_Error_Runtime

in Controller at line 346
JsonResponse renderJson(array $data = array(), int $httpStatus = JsonResponse::HTTP_OK)

Parameters

array $data
int $httpStatus

Return Value

JsonResponse

in FrontendController at line 455
EntityListManager createEntityListManager(mixed $entity, array $criteria = array(), array $ordering = array())

Creates and returns an EntityListManager instance.

Parameters

mixed $entity Entity class path
array $criteria
array $ordering

Return Value

EntityListManager

in Controller at line 452
ContactFormManager createContactFormManager()

Create and return a ContactFormManager to build and send contact form by email.

Return Value

ContactFormManager

in Controller at line 462
EmailManager createEmailManager()

Create and return a EmailManager to build and send emails.

Return Value

EmailManager

in AppController at line 73
static string getThemeName()

Return Value

string

in AppController at line 87
static string getThemeAuthor()

Return Value

string

in AppController at line 101
static string getThemeCopyright()

Return Value

string

in AppController at line 116
static string getThemeDir()

Return Value

string

in AppController at line 124
static string getThemeMainClassName()

Return Value

string Main theme class name

in AppController at line 132
static string getThemeMainClass()

Return Value

string Main theme class (FQN class with namespace)

in AppController at line 149
static string getThemeRequire()

Return Value

string

in AppController at line 163
static boolean isBackendTheme()

Return Value

boolean

in AppController at line 183
__init()

Initialize controller with its twig environment.

in AppController at line 194
static FileLocator getFileLocator()

Return a file locator with theme Resource folder.

Return Value

FileLocator

in AppController at line 207
static RouteCollection getRoutes()

Return Value

RouteCollection

in AppController at line 219
static RouteCollection getBackendRoutes()

These routes are used to extend Roadiz back-office.

Return Value

RouteCollection

in AppController at line 236
static string getThemeFolder()

Return theme root folder.

Return Value

string

in AppController at line 251
static string getResourcesFolder()

Return theme Resource folder according to main theme class inheriting AppController.

Uses \ReflectionClass to resolve final theme class folder whether it’s located in project folder or in vendor folder.

Return Value

string

in AppController at line 258
static string getViewsFolder()

Return Value

string

in AppController at line 265
static string getTranslationsFolder()

Return Value

string

in AppController at line 272
string getStaticResourcesUrl()

Return Value

string

in FrontendController at line 309
$this prepareBaseAssignation()

Add a default translation locale for static routes and node SEO data.

  • [parent assignations…]
  • defaultlocale
  • meta
    • siteName
    • siteCopyright
    • siteDescription

Return Value

$this

at line 118
Response throw404(string $message = '')

Return a Response with default backend 404 error page.

Parameters

string $message Additionnal message to describe 404 error.

Return Value

Response

in AppController at line 412
Theme getTheme()

Return the current Theme

Return Value

Theme

at line 165
static setupDependencyInjection(Container $container)

Parameters

Container $container

in AppController at line 531
publishConfirmMessage(Request $request, string $msg, NodesSources $source = null)

Publish a confirm message in Session flash bag and logger interface.

Parameters

Request $request
string $msg
NodesSources $source

in AppController at line 544
publishErrorMessage(Request $request, string $msg, NodesSources $source = null)

Publish an error message in Session flash bag and logger interface.

Parameters

Request $request
string $msg
NodesSources $source

in AppController at line 560
validateNodeAccessForRole(string $role, integer|null $nodeId = null, boolean|false $includeChroot = false)

Validate a request against a given ROLE_* and check chroot and newsletter type/accces and throws an AccessDeniedException exception.

Parameters

string $role
integer|null $nodeId
boolean|false $includeChroot

Exceptions

AccessDeniedException

at line 144
Response maintenanceAction(Request $request)

Parameters

Request $request

Return Value

Response

in FrontendController at line 107
Response indexAction(Request $request, Node $node = null, Translation $translation = null)

Default action for any node URL.

Parameters

Request $request
Node $node
Translation $translation

Return Value

Response

at line 58
Response homeAction(Request $request, null $_locale = null)

Parameters

Request $request
null $_locale

Return Value

Response

in FrontendController at line 163
storeNodeAndTranslation(Node $node = null, Translation $translation = null)

Store current node and translation into controller.

It makes following fields available into template assignation:

  • node
  • nodeSource
  • translation
  • pageMeta
    • title
    • description
    • keywords

Parameters

Node $node
Translation $translation

in FrontendController at line 196
storeNodeSourceAndTranslation(NodesSources $nodeSource = null, Translation $translation = null)

Store current nodeSource and translation into controller.

It makes following fields available into template assignation:

  • node
  • nodeSource
  • translation
  • pageMeta
    • title
    • description
    • keywords

Parameters

NodesSources $nodeSource
Translation $translation

in FrontendController at line 227
__initFromOtherController(array $baseAssignation = array(), Container $themeContainer = null)

Initialize controller with environment from an other controller in order to avoid initializing same component again.

Parameters

array $baseAssignation
Container $themeContainer

in FrontendController at line 388
array getNodeSEO(NodesSources $fallbackNodeSource = null)

Get SEO informations for current node.

This method must return a 3-fields array with:

  • title
  • description
  • keywords

Parameters

NodesSources $fallbackNodeSource

Return Value

array