Beta version

class CustomFormController extends CmsController

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()

Prepare base informations to be rendered in twig templates.

Response
throw404(string $message = '')

Return a Response with default backend 404 error page.

getTheme()

Return the current Theme

static 
setupDependencyInjection(Container $container)

Append objects to the global dependency injection container.

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)

Generate a simple view to inform visitors that website is currently unavailable.

Response
addAction(Request $request, int $customFormId)

No description

Response
sentAction(Request $request, int $customFormId)

No description

bool
sendAnswer(array $assignation, string $receiver)

Send an answer form by Email.

array
addCustomFormAnswer(array $data, CustomForm $customForm, EntityManager $em)

Add a custom form answer into database.

FormInterface
buildForm(Request $request, CustomForm $customForm, boolean $forceExpanded = false)

No description

array|RedirectResponse
prepareAndHandleCustomFormAssignation(Request $request, CustomForm $customFormsEntity, RedirectResponse $redirection, boolean $forceExpanded = false, string|null $emailSender = null)

Prepare and handle a CustomForm Form then send a confirm email.

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 Controller at line 435
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 CmsController at line 52
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 CmsController at line 43
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

at line 50
string getStaticResourcesUrl()

Return Value

string

in AppController at line 349
$this prepareBaseAssignation()

Prepare base informations to be rendered in twig templates.

Available contents

  • request: Main request object
  • head
    • ajax: boolean
    • cmsVersion
    • cmsVersionNumber
    • cmsBuild
    • devMode: boolean
    • baseUrl
    • filesUrl
    • resourcesUrl
    • absoluteResourcesUrl
    • staticDomainName
    • ajaxToken
    • fontToken
    • universalAnalyticsId
    • useCdn
  • session
    • messages
    • id
    • user
  • securityAuthorizationChecker

Return Value

$this

in AppController at line 395
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

in AppController at line 438
static setupDependencyInjection(Container $container)

Append objects to the global dependency injection 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

in AppController at line 601
Response maintenanceAction(Request $request)

Generate a simple view to inform visitors that website is currently unavailable.

Parameters

Request $request

Return Value

Response

at line 61
Response addAction(Request $request, int $customFormId)

Parameters

Request $request
int $customFormId

Return Value

Response

at line 100
Response sentAction(Request $request, int $customFormId)

Parameters

Request $request
int $customFormId

Return Value

Response

at line 122
bool sendAnswer(array $assignation, string $receiver)

Send an answer form by Email.

Parameters

array $assignation
string $receiver

Return Value

bool

at line 156
array addCustomFormAnswer(array $data, CustomForm $customForm, EntityManager $em)

Add a custom form answer into database.

Parameters

array $data Data array from POST form
CustomForm $customForm
EntityManager $em

Return Value

array $fieldsData

at line 211
FormInterface buildForm(Request $request, CustomForm $customForm, boolean $forceExpanded = false)

Parameters

Request $request
CustomForm $customForm
boolean $forceExpanded

Return Value

FormInterface

at line 241
array|RedirectResponse prepareAndHandleCustomFormAssignation(Request $request, CustomForm $customFormsEntity, RedirectResponse $redirection, boolean $forceExpanded = false, string|null $emailSender = null)

Prepare and handle a CustomForm Form then send a confirm email.

  • This method will return an assignation array if form is not validated.
    • customForm
    • fields
    • form
  • If form is validated, RedirectResponse will be returned.

Parameters

Request $request
CustomForm $customFormsEntity
RedirectResponse $redirection
boolean $forceExpanded
string|null $emailSender

Return Value

array|RedirectResponse