PHP Class Bolt\Storage\FieldManager

Datei anzeigen Open project: bolt/bolt Class Usage Examples

Protected Properties

Property Type Description
$boltConfig Bolt\Config
$customHandlers
$em EntityManager
$handlers
$sanitiser Bolt\Storage\Field\Sanitiser\SanitiserInterface
$typemap

Public Methods

Method Description
__construct ( array $typemap, Config $config, Bolt\Storage\Field\Sanitiser\SanitiserInterface $sanitiser ) Constructor.
addFieldType ( $name, $handler ) Shorthand to add a field to both the new and legacy managers.
get ( $class, $mapping ) : mixed Gets the field instance for the supplied class.
getFieldFor ( $type ) : boolean | mixed Looks up a type from the typemap and returns a field class.
hasCustomHandler ( $name ) : boolean Note, this method is for Bolt use only, as a way to distinguish which fields have been added outside of the core system. It will be removed in a future version.
setEntityManager ( EntityManager $em = null ) Set an instance of EntityManager
setHandler ( $class, callable | object $handler ) Links the field name found in the config to a callable handler.

Method Details

__construct() public method

Requires access to legacy Config class so that it can add fields to the old-style manager This can be removed once the templating has migrated to the new system.
public __construct ( array $typemap, Config $config, Bolt\Storage\Field\Sanitiser\SanitiserInterface $sanitiser )
$typemap array
$config Bolt\Config
$sanitiser Bolt\Storage\Field\Sanitiser\SanitiserInterface

addFieldType() public method

Shorthand to add a field to both the new and legacy managers.
public addFieldType ( $name, $handler )
$name
$handler

get() public method

Gets the field instance for the supplied class.
public get ( $class, $mapping ) : mixed
$class
$mapping
return mixed

getFieldFor() public method

Looks up a type from the typemap and returns a field class.
public getFieldFor ( $type ) : boolean | mixed
$type
return boolean | mixed

hasCustomHandler() public method

Note, this method is for Bolt use only, as a way to distinguish which fields have been added outside of the core system. It will be removed in a future version.
public hasCustomHandler ( $name ) : boolean
$name
return boolean

setEntityManager() public method

Set an instance of EntityManager
public setEntityManager ( EntityManager $em = null )
$em EntityManager

setHandler() public method

Links the field name found in the config to a callable handler.
public setHandler ( $class, callable | object $handler )
$class
$handler callable | object

Property Details

$boltConfig protected_oe property

protected Config,Bolt $boltConfig
return Bolt\Config

$customHandlers protected_oe property

protected $customHandlers

$em protected_oe property

protected EntityManager,Bolt\Storage $em
return EntityManager

$handlers protected_oe property

protected $handlers

$sanitiser protected_oe property

protected SanitiserInterface,Bolt\Storage\Field\Sanitiser $sanitiser
return Bolt\Storage\Field\Sanitiser\SanitiserInterface

$typemap protected_oe property

protected $typemap