Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setRender example
protected
$aclPermissions
=
[
]
;
/** * Enable script renderer and json request plugin * Do acl checks * * @return void */
public
function
init
(
)
{
$this
->
Front
(
)
->
Plugins
(
)
->
ScriptRenderer
(
)
->
setRender
(
)
;
$this
->
Front
(
)
->
Plugins
(
)
->
JsonRequest
(
)
->
setParseInput
(
)
->
setParseParams
(
[
'group', 'sort', 'filter'
]
)
->
setPadding
(
$this
->
Request
(
)
->
get
(
'targetField'
)
)
;
// Call controller acl rules (user - defined)
$this
->
initAcl
(
)
;
}
/** * Enable json renderer for index / load action * Checks acl rules */
protected
$auth
;
/** * Loads auth and script renderer resource * * @return void */
public
function
init
(
)
{
$this
->auth =
Shopware
(
)
->
Plugins
(
)
->
Backend
(
)
->
Auth
(
)
;
$this
->auth->
setNoAuth
(
)
;
$this
->
Front
(
)
->
Plugins
(
)
->
ScriptRenderer
(
)
->
setRender
(
)
;
}
/** * {@inheritdoc} */
public
function
getWhitelistedCSRFActions
(
)
{
return
[
'index',
'auth',
'changeLocale',
use
Shopware\Bundle\MediaBundle\MediaServiceInterface;
class
Shopware_Controllers_Frontend_Media
extends
Enlight_Controller_Action
{
/** * Disable any output */
public
function
init
(
)
{
$this
->
Front
(
)
->
Plugins
(
)
->
ScriptRenderer
(
)
->
setRender
(
false
)
;
$this
->
Front
(
)
->
Plugins
(
)
->
ViewRenderer
(
)
->
setNoRender
(
true
)
;
$this
->
Front
(
)
->
Plugins
(
)
->
Json
(
)
->
setRenderer
(
false
)
;
}
public
function
fallbackAction
(
)
{
$mediaService
=
$this
->
get
(
MediaServiceInterface::
class
)
;
$requestedImage
=
$this
->
Request
(
)
->
getRequestUri
(
)
;
if
(
!
$mediaService
->
has
(
$requestedImage
)
)
{
$this
->
Response
(
)
->
setStatusCode
(
404
)
;
use
Shopware\Components\Theme\PathResolver;
class
Shopware_Controllers_Frontend_Error
extends
Enlight_Controller_Action
implements
CSRFWhitelistAware
{
/** * Disable front plugins * * @return void */
public
function
init
(
)
{
$this
->
Front
(
)
->
Plugins
(
)
->
ScriptRenderer
(
)
->
setRender
(
false
)
;
$this
->
Front
(
)
->
Plugins
(
)
->
ViewRenderer
(
)
->
setNoRender
(
false
)
;
$this
->
Front
(
)
->
Plugins
(
)
->
Json
(
)
->
setRenderer
(
false
)
;
}
/** * Load correct template */
public
function
preDispatch
(
)
{
if
(
$this
->
Request
(
)
->
getActionName
(
)
=== 'service'
)
{
return
;
}
public
function
init
(
)
{
if
(
!
$this
->
Request
(
)
->
getActionName
(
)
|| \
in_array
(
$this
->
Request
(
)
->
getActionName
(
)
,
[
'index', 'load'
]
)
)
{
$this
->
View
(
)
->
addTemplateDir
(
'.'
)
;
$this
->
Front
(
)
->
Plugins
(
)
->
ScriptRenderer
(
)
->
setRender
(
)
;
Shopware
(
)
->
Plugins
(
)
->
Backend
(
)
->
Auth
(
)
->
setNoAuth
(
)
;
}
else
{
parent::
init
(
)
;
}
}
/** * {@inheritdoc} */
public
function
getWhitelistedCSRFActions
(
)
{