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)

No description

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 $route, mixed $parameters = array(), boolean $absolute = false)

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 = '')

Return a Response from a template string with its rendering assignation.

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.

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

static bool
sendAnswer(array $assignation, string $receiver, Request $request, TranslatorInterface $translator, Twig_Environment $twigEnv, Swift_Mailer $mailer)

Send an answer form by Email.

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

Add a custom form answer into database.

static Form
buildForm(Request $request, CustomForm $customForm, FormFactoryInterface $formFactory, boolean $forceExpanded = false)

No description

static array|RedirectResponse
prepareAndHandleCustomFormAssignation(Request $request, CustomForm $customFormsEntity, FormFactoryInterface $formFactory, EntityManager $em, Twig_Environment $twigEnv, Swift_Mailer $mailer, Translator $translator, RedirectResponse $redirection, LoggerInterface $logger = null, boolean $forceExpanded = false, string|null $emailSender = null)

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

Details

in Controller at line 65
Request getRequest()

Shortcut to return the request service.

Return Value

Request

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

Parameters

Container $container

Return Value

ContainerAwareInterface

in Controller at line 85
Container getContainer()

Return Value

Container

in Controller at line 99
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 107
mixed get(string $serviceName)

Return a service from container.

Parameters

string $serviceName

Return Value

mixed

in Controller at line 115
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 125
AuthorizationChecker getAuthorizationChecker()

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

Return Value

AuthorizationChecker

in Controller at line 135
TokenStorageInterface getTokenStorage()

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

Return Value

TokenStorageInterface

in Controller at line 145
EntityManager em()

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

Return Value

EntityManager

in Controller at line 153
Translator getTranslator()

Return Value

Translator

in Controller at line 161
Twig_Environment getTwig()

Return Value

Twig_Environment

in Controller at line 175
string generateUrl(string $route, mixed $parameters = array(), boolean $absolute = false)

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

Parameters

string $route
mixed $parameters
boolean $absolute

Return Value

string

in Controller at line 188
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 196
static string getCalledClass()

Return Value

string

in Controller at line 213
validateAccessForRole(string $role)

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

Parameters

string $role

Exceptions

AccessDeniedException

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

Custom route for redirecting routes with a trailing slash.

Parameters

Request $request

Return Value

RedirectResponse

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

Returns a rendered view.

Parameters

string $view
array $parameters

Return Value

string

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

Return a Response from a template string with its rendering assignation.

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 418
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 435
ContactFormManager createContactFormManager()

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

Return Value

ContactFormManager

in AppController at line 74
static string getThemeName()

Return Value

string

in AppController at line 88
static string getThemeAuthor()

Return Value

string

in AppController at line 102
static string getThemeCopyright()

Return Value

string

in AppController at line 117
static string getThemeDir()

Return Value

string

in AppController at line 125
static string getThemeMainClassName()

Return Value

string Main theme class name

in AppController at line 133
static string getThemeMainClass()

Return Value

string Main theme class (FQN class with namespace)

in AppController at line 150
static string getThemeRequire()

Return Value

string

in AppController at line 164
static boolean isBackendTheme()

Return Value

boolean

in AppController at line 184
__init()

Initialize controller with its twig environment.

in AppController at line 195
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 220
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 252
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 259
static string getViewsFolder()

Return Value

string

in AppController at line 266
static string getTranslationsFolder()

Return Value

string

at line 55
string getStaticResourcesUrl()

Return Value

string

in AppController at line 350
$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 396
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 413
Theme getTheme()

Return the current Theme

Return Value

Theme

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

Append objects to the global dependency injection container.

Parameters

Container $container

in AppController at line 532
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 545
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 561
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 602
Response maintenanceAction(Request $request)

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

Parameters

Request $request

Return Value

Response

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

Parameters

Request $request
int $customFormId

Return Value

Response

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

Parameters

Request $request
int $customFormId

Return Value

Response

at line 137
static bool sendAnswer(array $assignation, string $receiver, Request $request, TranslatorInterface $translator, Twig_Environment $twigEnv, Swift_Mailer $mailer)

Send an answer form by Email.

Parameters

array $assignation
string $receiver
Request $request
TranslatorInterface $translator
Twig_Environment $twigEnv
Swift_Mailer $mailer

Return Value

bool

at line 174
static 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 230
static Form buildForm(Request $request, CustomForm $customForm, FormFactoryInterface $formFactory, boolean $forceExpanded = false)

Parameters

Request $request
CustomForm $customForm
FormFactoryInterface $formFactory
boolean $forceExpanded

Return Value

Form

at line 263
static array|RedirectResponse prepareAndHandleCustomFormAssignation(Request $request, CustomForm $customFormsEntity, FormFactoryInterface $formFactory, EntityManager $em, Twig_Environment $twigEnv, Swift_Mailer $mailer, Translator $translator, RedirectResponse $redirection, LoggerInterface $logger = null, 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
FormFactoryInterface $formFactory
EntityManager $em
Twig_Environment $twigEnv
Swift_Mailer $mailer
Translator $translator
RedirectResponse $redirection
LoggerInterface $logger
boolean $forceExpanded
string|null $emailSender

Return Value

array|RedirectResponse