-
Docs
Backend
-
Behaviors
-
Classes
-
Controllers
-
Database
-
Seeds
-
-
Facades
-
FormWidgets
-
Helpers
-
Exception
- Backend
-
-
Models
-
ReportWidgets
-
Skins
-
Traits
-
Widgets
- ServiceProvider
-
-
Cms
-
Classes
- Asset
- AutoDatasource
- CmsCompoundObject
- CmsController
- CmsException
- CmsObject
- CmsObjectCollection
- CodeBase
- CodeParser
- ComponentBase
- ComponentHelpers
- ComponentManager
- ComponentPartial
- Content
- Controller
- Layout
- LayoutCode
- MediaLibrary
- MediaLibraryItem
- MediaViewHelper
- Meta
- ObjectMemoryCache
- Page
- PageCode
- Partial
- PartialCode
- PartialStack
- Router
- Theme
- ThemeManager
-
Components
-
Contracts
-
Controllers
-
Facades
-
FormWidgets
-
Helpers
-
Models
-
ReportWidgets
-
Traits
-
Twig
- ComponentNode
- ComponentTokenParser
- ContentNode
- ContentTokenParser
- DebugExtension
- DefaultNode
- DefaultTokenParser
- Extension
- FlashNode
- FlashTokenParser
- FrameworkNode
- FrameworkTokenParser
- Loader
- PageNode
- PageTokenParser
- PartialNode
- PartialTokenParser
- PlaceholderNode
- PlaceholderTokenParser
- PutNode
- PutTokenParser
- ScriptsNode
- ScriptsTokenParser
- StylesNode
- StylesTokenParser
-
Widgets
- ServiceProvider
-
-
System
-
Behaviors
-
Classes
-
Console
-
Controllers
-
Database
-
Helpers
-
Models
-
ReportWidgets
-
Traits
-
Twig
- ServiceProvider
-
-
Events
-
backend
-
ajax
-
filter
-
form
-
list
-
menu
-
page
-
user
-
-
cms
-
ajax
-
block
-
combiner
-
component
-
object
-
page
-
router
-
template
-
theme
-
-
halcyon
-
datasource
-
-
mailer
-
media
-
model
-
system
-
assets
-
console
-
mirror
-
theme
-
-
reportwidgets
-
settings
- extendConfigFile
-
-
translator
-
-
Library
-
Argon
-
Auth
-
Models
- AuthException
- Manager
-
-
Config
-
Cookie
-
Middleware
-
-
Database
-
Attach
-
Behaviors
-
Concerns
-
Connections
-
Connectors
-
Models
-
Relations
-
Schema
-
Traits
-
Updates
- README
- Builder
- Collection
- DatabaseServiceProvider
- DataFeed
- Dongle
- MemoryCache
- Model
- ModelBehavior
- ModelException
- NestedTreeScope
- Pivot
- QueryBuilder
- SortableScope
- TreeCollection
- Updater
-
-
Events
-
Exception
-
Extension
-
Filesystem
-
Flash
-
Foundation
-
Bootstrap
-
Console
-
Exception
-
Http
-
Middleware
- Kernel
-
-
Providers
- Application
- Maker
-
-
Halcyon
-
Datasource
-
Exception
-
Processors
-
Traits
- README
- Builder
- Collection
- HalcyonServiceProvider
- MemoryCacheManager
- MemoryRepository
- Model
-
-
Html
-
Mail
-
Network
-
Parse
-
Router
-
Scaffold
-
Support
-
Translation
-
- Documentation
- API
- System
- Classes
- MarkupManager
System\Classes\MarkupManager
Source: ~/modules/system/classes/MarkupManager.php
This class manages Twig functions, token parsers and filters.
Protected properties
protected array $callbacks
Cache of registration callbacks.
protected array $items
Globally registered extension items
protected System\Classes\PluginManager $pluginManager
protected array $transactionItems
Transaction based extension items
protected bool $transactionMode
Manager is in transaction mode
protected static $instance
Public methods
public void __clone()
public void __wakeup()
public void beginTransaction()
Start a new transaction.
public void endTransaction()
Ends an active transaction.
public static void forgetInstance()
Forget this singleton's instance if it exists
public static void instance()
Create a new instance of this singleton.
public array listExtensions($type $type)
Returns a list of the registered Twig extensions of a type.
Parameters
- $type $type - String The Twig extension type
public array listFilters()
Returns a list of the registered Twig filters.
public array listFunctions()
Returns a list of the registered Twig functions.
public array listTokenParsers()
Returns a list of the registered Twig token parsers.
public array makeTwigFilters(array $filters=array())
Makes a set of Twig filters for use in a twig extension.
Parameters
- array $filters - Current collection
public array makeTwigFunctions(array $functions=array())
Makes a set of Twig functions for use in a twig extension.
Parameters
- array $functions - Current collection
public array makeTwigTokenParsers(array $parsers=array())
Makes a set of Twig token parsers for use in a twig extension.
Parameters
- array $parsers - Current collection
public void registerCallback(callable $callback)
Registers a callback function that defines simple Twig extensions.
The callback function should register menu items by calling the manager's
registerFunctions, registerFilters, registerTokenParsers function.
The manager instance is passed to the callback function as an argument. Usage:
MarkupManager::registerCallback(function ($manager) {
$manager->registerFilters([...]);
$manager->registerFunctions([...]);
$manager->registerTokenParsers([...]);
});
Parameters
- callable $callback - A callable function.
public void registerExtensions(string $type, array $definitions)
Registers the CMS Twig extension items. The argument is an array of the extension definitions. The array keys represent the function/filter name, specific for the plugin/module. Each element in the array should be an associative array.
Parameters
- string $type - The extension type: filters, functions, tokens
- array $definitions - An array of the extension definitions.
public void registerFilters(array $definitions)
Registers a CMS Twig Filter
Parameters
- array $definitions - An array of the extension definitions.
public void registerFunctions(array $definitions)
Registers a CMS Twig Function
Parameters
- array $definitions - An array of the extension definitions.
public void registerTokenParsers(array $definitions)
Registers a CMS Twig Token Parser
Parameters
- array $definitions - An array of the extension definitions.
public void transaction(Closure $callback)
Execute a single serving transaction, containing filters, functions, and token parsers that are disposed of afterwards.
Parameters
- Closure $callback
Protected methods
protected void __construct()
Constructor.
protected void init()
Initialize this singleton.
protected mixed isWildCallable(callable $callable, string|bool $replaceWith=false)
Tests if a callable type contains a wildcard, also acts as a utility to replace the wildcard with a string.
Parameters
- callable $callable
- string|bool $replaceWith