class ThemesImportController extends ImportController (View source)

[email protected]}

Constants

AJAX_TOKEN_INTENTION

SCHEMA_TOKEN_INTENTION

FONT_TOKEN_INTENTION

Properties

protected Container|null $container from Controller
protected Theme; $theme Theme entity. from AppController
static protected string $themeName Theme name. from AppController
static protected string $themeAuthor Theme author description. from AppController
static protected string $themeCopyright Theme copyright licence. from AppController
static protected string $themeDir Theme base directory name. from AppController
static protected string $themeRequire Theme requires a minimal CMS version. from AppController
static protected boolean $backendTheme Is theme for backend? from AppController
protected array $assignation Assignation for twig template engine. from AppController

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

Prepare base informations to be rendered in twig templates.

Response
throw404(string $message = '')

No description

getTheme()

Return the current Theme

static 
setupDependencyInjection(Container $container)

Append objects to the global dependency injection container.

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
genericImportAction(string $classImporter, Request $request, integer $themeId = null)

No description

string|null
getFilename(Request $request)

Get filename to import from POST request.

Response
importSettingsAction(Request $request, int $themeId = null)

Import theme's Settings file.

Response
importRolesAction(Request $request, int $themeId = null)

Import theme's Roles file.

Response
importGroupsAction(Request $request, int $themeId = null)

Import theme's Groups file.

Response
importNodeTypesAction(Request $request, int $themeId = null)

Import NodeTypes file.

Response
importTagsAction(Request $request, int $themeId = null)

Import Tags file.

Response
importNodesAction(Request $request, int $themeId = null)

Import Nodes file.

Response
importContent(string $pathFile, string $classImporter, int $themeId)

Import theme's Settings file.

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

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

Response throw404(string $message = '')

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

protected Response genericImportAction(string $classImporter, Request $request, integer $themeId = null)

Parameters

string $classImporter
Request $request
integer $themeId

Return Value

Response

protected string|null getFilename(Request $request)

Get filename to import from POST request.

Parameters

Request $request

Return Value

string|null

Response importSettingsAction(Request $request, int $themeId = null)

Import theme's Settings file.

Parameters

Request $request
int $themeId

Return Value

Response

Response importRolesAction(Request $request, int $themeId = null)

Import theme's Roles file.

Parameters

Request $request
int $themeId

Return Value

Response

Response importGroupsAction(Request $request, int $themeId = null)

Import theme's Groups file.

Parameters

Request $request
int $themeId

Return Value

Response

Response importNodeTypesAction(Request $request, int $themeId = null)

Import NodeTypes file.

Parameters

Request $request
int $themeId

Return Value

Response

Response importTagsAction(Request $request, int $themeId = null)

Import Tags file.

Parameters

Request $request
int $themeId

Return Value

Response

Response importNodesAction(Request $request, int $themeId = null)

Import Nodes file.

Parameters

Request $request
int $themeId

Return Value

Response

Response importContent(string $pathFile, string $classImporter, int $themeId)

Import theme's Settings file.

Parameters

string $pathFile
string $classImporter
int $themeId

Return Value

Response