Contao Utils Bundle

ContainerUtil extends AbstractServiceSubscriber
in package

Table of Contents

Properties

$filesystem  : Filesystem
$framework  : ContaoFramework
$kernel  : KernelInterface
$kernelBundles  : array<string|int, mixed>
$locator  : ContainerInterface
$requestStack  : RequestStack
$scopeMatcher  : ScopeMatcher

Methods

__construct()  : mixed
getBundlePath()  : string|null
Returns the path to the bundle in vendor folder Attention: resolves symlinks!
getBundleResourcePath()  : string|array<string|int, mixed>|null
Returns the path or paths to a ressource within a bundle Attention: resolves symlinks!
getSubscribedServices()  : mixed
isBackend()  : bool
Return if currently in backend scope.
isBundleActive()  : bool
Checks if some bundle is active. Pass in the class name (e.g. 'HeimrichHannot\FilterBundle\HeimrichHannotContaoFilterBundle' or the legacy Contao 3 name like 'news').
isDev()  : bool
Return if in dev environment.
isFrontend()  : bool
Return if currently in frontend scope.
isFrontendCron()  : bool
Return if in cron route (Attention: not cron command!).
isInstall()  : bool
Return if in install route (Attention: not migration!).
isMaintenanceModeActive()  : bool
Return if currently in maintenance mode.
isPreviewMode()  : bool
Return if currently in preview mode.
log()  : void
Add a log entry to contao system log.

Properties

$kernelBundles

protected array<string|int, mixed> $kernelBundles

Methods

__construct()

public __construct(ContainerInterface $locator, array<string|int, mixed> $kernelBundles, KernelInterface $kernel, ContaoFrameworkInterface $framework, ScopeMatcher $scopeMatcher, RequestStack $requestStack, Filesystem $filesystem) : mixed
Parameters
$locator : ContainerInterface
$kernelBundles : array<string|int, mixed>
$kernel : KernelInterface
$framework : ContaoFrameworkInterface
$scopeMatcher : ScopeMatcher
$requestStack : RequestStack
$filesystem : Filesystem

getBundlePath()

Returns the path to the bundle in vendor folder Attention: resolves symlinks!

public getBundlePath(string $bundleClass) : string|null
Parameters
$bundleClass : string

The bundle class class constant (VendorMyBundle::class)

Return values
string|null

False on error

getBundleResourcePath()

Returns the path or paths to a ressource within a bundle Attention: resolves symlinks!

public getBundleResourcePath(string $bundleClass[, string $ressourcePath = '' ][, bool $first = false ]) : string|array<string|int, mixed>|null
Parameters
$bundleClass : string

The bundle class class constant (VendorMyBundle::class)

$ressourcePath : string = ''

a ressource or path to ressource

$first : bool = false

Returns only first occurrence if multiple paths found

Return values
string|array<string|int, mixed>|null

False on error

getSubscribedServices()

public static getSubscribedServices() : mixed

isBackend()

Return if currently in backend scope.

public isBackend() : bool
Return values
bool

isBundleActive()

Checks if some bundle is active. Pass in the class name (e.g. 'HeimrichHannot\FilterBundle\HeimrichHannotContaoFilterBundle' or the legacy Contao 3 name like 'news').

public isBundleActive(string $bundleName) : bool
Parameters
$bundleName : string
Return values
bool

isDev()

Return if in dev environment.

public isDev() : bool
Return values
bool

isFrontend()

Return if currently in frontend scope.

public isFrontend() : bool
Return values
bool

isFrontendCron()

Return if in cron route (Attention: not cron command!).

public isFrontendCron() : bool
Return values
bool

isInstall()

Return if in install route (Attention: not migration!).

public isInstall() : bool
Return values
bool

isMaintenanceModeActive()

Return if currently in maintenance mode.

public isMaintenanceModeActive([mixed $page = null ]) : bool
Parameters
$page : mixed = null
Return values
bool

isPreviewMode()

Return if currently in preview mode.

public isPreviewMode() : bool
Return values
bool

log()

Add a log entry to contao system log.

public log(string $text, string $function, string $category) : void
Parameters
$text : string

The log message

$function : string

The function name. Typically METHOD

$category : string

The category name. Use constants in ContaoContext


        
On this page

Search results