class SettingsController extends RozierApp (View source)

Settings controller

Constants

AJAX_TOKEN_INTENTION

SCHEMA_TOKEN_INTENTION

FONT_TOKEN_INTENTION

DEFAULT_ITEM_PER_PAGE

Properties

protected Container|null $container from Controller
protected Theme; $theme Theme entity. from AppController
static protected $themeName from RozierApp
static protected $themeAuthor from RozierApp
static protected $themeCopyright from RozierApp
static protected $themeDir from RozierApp
static protected string $themeRequire Theme requires a minimal CMS version. from AppController
static protected $backendTheme from BackendController
protected array $assignation Assignation for twig template engine. from AppController
protected $formFactory from RozierApp
protected $themeContainer from RozierApp

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

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 = [], 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.

bindLocaleFromRoute(Request $request, string $_locale = null)

Make translation variable with the good localization.

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

Returns a rendered view.

Response
render(string $view, array $parameters = [], Response $response = null, string $namespace = "")

No description

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

No description

Response
forward(string $controller, array $path = [], array $query = [])

Forwards the request to another controller.

NotFoundHttpException
createNotFoundException(string $message = 'Not Found', Exception $previous = null)

Returns a NotFoundHttpException.

AccessDeniedException
createAccessDeniedException(string $message = 'Access Denied', Exception $previous = null)

Returns an AccessDeniedException.

Form
createForm(string|FormTypeInterface $type, mixed $data = null, array $options = [])

Creates and returns a Form instance from the type of the form.

FormBuilder
createFormBuilder(mixed $data = null, array $options = [])

Creates and returns a form builder instance.

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

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.

UserInterface|null
getUser()

Get a user from the tokenStorage.

bool
isGranted(mixed $attributes, mixed $object = null)

Checks if the attributes are granted against the current authentication token and optionally supplied object.

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

No description

from RozierApp
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 global container.

from RozierApp
null|Node
getHome(Translation $translation = null)

No description

getRoot()

No description

publishMessage(Request $request, string $msg, string $level = "confirm", NodesSources $source = null)

Publish a message in Session flash bag and logger interface.

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.

array
getErrorsAsArray(FormInterface $form)

Return all Form errors as an array.

Response
indexAction(Request $request)

List every settings.

Response
cssAction(Request $request)

No description

from RozierApp
Response
byGroupAction(Request $request, int $settingGroupId)

No description

commonSettingList(Request $request, $settingGroup = null)

No description

Response
editAction(Request $request, int $settingId)

Return an edition form for requested setting.

Response
addAction(Request $request)

Return an creation form for requested setting.

Response
deleteAction(Request $request, int $settingId)

Return an deletion form for requested setting.

setSettingValue(string $value, Setting $setting)

Set setting value according to its type.

static 
getFormOptionsForSetting($setting, Translator $translator, $shortEdit = false)

No description

Details

Request getRequest()

Shortcut to return the request service.

Return Value

Request

ContainerAwareInterface setContainer(Container $container)

Sets the Container associated with this Controller.

Parameters

Container $container

Return Value

ContainerAwareInterface

Container getContainer()

Return Value

Container

mixed getService(string|null $key = null) deprecated

deprecated Use Controller::get to better match Symfony style.

Get mixed object from Dependency Injection container.

Alias for $this->container[$key]

Parameters

string|null $key

Return Value

mixed

mixed get(string $serviceName)

Return a service from container.

Parameters

string $serviceName

Return Value

mixed

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

AuthorizationChecker getAuthorizationChecker()

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

Return Value

AuthorizationChecker

TokenStorageInterface getTokenStorage()

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

Return Value

TokenStorageInterface

EntityManager em()

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

Return Value

EntityManager

Translator getTranslator()

Return Value

Translator

Twig_Environment getTwig()

Return Value

Twig_Environment

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

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

Parameters

string|NodesSources $route
mixed $parameters
int $referenceType

Return Value

string

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

Returns a RedirectResponse to the given URL.

Parameters

string $url
integer $status

Return Value

RedirectResponse

static string getCalledClass()

Return Value

string

validateAccessForRole(string $role)

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

Parameters

string $role

Exceptions

AccessDeniedException

RedirectResponse removeTrailingSlashAction(Request $request)

Custom route for redirecting routes with a trailing slash.

Parameters

Request $request

Return Value

RedirectResponse

protected Translation bindLocaleFromRoute(Request $request, string $_locale = null)

Make translation variable with the good localization.

Parameters

Request $request
string $_locale

Return Value

Translation

Exceptions

NoTranslationAvailableException

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

Returns a rendered view.

Parameters

string $view
array $parameters

Return Value

string

Response render(string $view, array $parameters = [], 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

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

Parameters

array $data
int $httpStatus

Return Value

JsonResponse

protected Response forward(string $controller, array $path = [], array $query = [])

Forwards the request to another controller.

Parameters

string $controller The controller name (a string like BlogBundle:Post:index)
array $path An array of path parameters
array $query An array of query parameters

Return Value

Response A Response instance

protected NotFoundHttpException createNotFoundException(string $message = 'Not Found', Exception $previous = null)

Returns a NotFoundHttpException.

This will result in a 404 response code. Usage example:

throw $this->createNotFoundException('Page not found!');

Parameters

string $message A message
Exception $previous The previous exception

Return Value

NotFoundHttpException

protected AccessDeniedException createAccessDeniedException(string $message = 'Access Denied', Exception $previous = null)

Returns an AccessDeniedException.

This will result in a 403 response code. Usage example:

throw $this->createAccessDeniedException('Unable to access this page!');

Parameters

string $message A message
Exception $previous The previous exception

Return Value

AccessDeniedException

protected Form createForm(string|FormTypeInterface $type, mixed $data = null, array $options = [])

Creates and returns a Form instance from the type of the form.

Parameters

string|FormTypeInterface $type The built type of the form
mixed $data The initial data for the form
array $options Options for the form

Return Value

Form

protected FormBuilder createFormBuilder(mixed $data = null, array $options = [])

Creates and returns a form builder instance.

Parameters

mixed $data The initial data for the form
array $options Options for the form

Return Value

FormBuilder

EntityListManager createEntityListManager(mixed $entity, array $criteria = [], array $ordering = [])

Creates and returns an EntityListManager instance.

Parameters

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

Return Value

EntityListManager

ContactFormManager createContactFormManager()

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

Return Value

ContactFormManager

EmailManager createEmailManager()

Create and return a EmailManager to build and send emails.

Return Value

EmailManager

protected UserInterface|null getUser()

Get a user from the tokenStorage.

Return Value

UserInterface|null

Exceptions

LogicException If tokenStorage is not available

See also

TokenInterface::getUser()

protected bool isGranted(mixed $attributes, mixed $object = null)

Checks if the attributes are granted against the current authentication token and optionally supplied object.

Parameters

mixed $attributes The attributes
mixed $object The object

Return Value

bool

Exceptions

LogicException

static string getThemeName()

Return Value

string

static string getThemeAuthor()

Return Value

string

static string getThemeCopyright()

Return Value

string

static string getThemeDir()

Return Value

string

static string getThemeMainClassName()

Return Value

string Main theme class name

static string getThemeMainClass()

Return Value

string Main theme class (FQN class with namespace)

static string getThemeRequire()

Return Value

string

static boolean isBackendTheme()

Return Value

boolean

__init()

Initialize controller with its twig environment.

static FileLocator getFileLocator()

Return a file locator with theme Resource folder.

Return Value

FileLocator

static RouteCollection getRoutes()

Return Value

RouteCollection

static RouteCollection getBackendRoutes()

These routes are used to extend Roadiz back-office.

Return Value

RouteCollection

static string getThemeFolder()

Return theme root folder.

Return Value

string

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

static string getViewsFolder()

Return Value

string

static string getTranslationsFolder()

Return Value

string

string getStaticResourcesUrl()

Return Value

string

$this prepareBaseAssignation()

Return Value

$this

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

Theme getTheme()

Return the current Theme

Return Value

Theme

static setupDependencyInjection(Container $container)

Append objects to global container.

Parameters

Container $container

protected null|Node getHome(Translation $translation = null)

Parameters

Translation $translation

Return Value

null|Node

protected Node getRoot()

Return Value

Node

protected publishMessage(Request $request, string $msg, string $level = "confirm", NodesSources $source = null)

Publish a message in Session flash bag and logger interface.

Parameters

Request $request
string $msg
string $level
NodesSources $source

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

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

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

Response maintenanceAction(Request $request)

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

Parameters

Request $request

Return Value

Response

protected array getErrorsAsArray(FormInterface $form)

Return all Form errors as an array.

Parameters

FormInterface $form

Return Value

array

Response indexAction(Request $request)

List every settings.

Parameters

Request $request

Return Value

Response $response

Response cssAction(Request $request)

Parameters

Request $request

Return Value

Response $response

Response byGroupAction(Request $request, int $settingGroupId)

Parameters

Request $request
int $settingGroupId

Return Value

Response

protected commonSettingList(Request $request, $settingGroup = null)

Parameters

Request $request
$settingGroup

Response editAction(Request $request, int $settingId)

Return an edition form for requested setting.

Parameters

Request $request
int $settingId

Return Value

Response

Response addAction(Request $request)

Return an creation form for requested setting.

Parameters

Request $request

Return Value

Response

Response deleteAction(Request $request, int $settingId)

Return an deletion form for requested setting.

Parameters

Request $request
int $settingId

Return Value

Response

protected setSettingValue(string $value, Setting $setting)

Set setting value according to its type.

Parameters

string $value
Setting $setting

protected CssType|JsonType|MarkdownType getFormTypeFromSettingType(Setting $setting)

Parameters

Setting $setting

Return Value

CssType|JsonType|MarkdownType

static getFormOptionsForSetting($setting, Translator $translator, $shortEdit = false)

Parameters

$setting
Translator $translator
$shortEdit