Configuration Directive Types
Movable Type supports a type
registry property with configuration directives which controls how their values should be parsed and/or aggregated. There are three types:
- scalar (default)
- array
- hash
Here’s what it looks like in the registry:
config_settings:
FavoriteWebSites:
type: array
Scalars
The default value of the type
property is scalar. This requires that the configuration directive possess only a single value. When two config directives are defined with the same name, then the last value specified take precedence. For example, if your mt-config.cgi
contained the following:
CGIPath /cgi-bin/mt/
MyDirective foo
MyDirective bar
Then the following:
$mgr->get_internal('MyDirective')
Could only return the value “bar” because it was the last to occur in the config file.
Arrays
Config directives of type ‘array’ result in Movable Type aggregating all config directive values that have the same name into an array or list.
For example, if your mt-config.cgi
contained the following:
CGIPath /cgi-bin/mt/
MyDirective foo
MyDirective bar
Then the following:
$mgr->get_internal('MyDirective')
Would return an array containing the values ‘foo’ and ‘bar.’
Hashes
Config directives of type ‘hash’ are expressed a little bit differently. Values are expressed in two parts: a hash key, and a hash value. For these types of directives Movable Type aggregates all config directives of the same name into an hash of key/value pairs.
For example, if your mt-config.cgi
contained the following:
CGIPath /cgi-bin/mt/
MyDirective foo 123
MyDirective bar abc
Then the following:
$mgr->get_internal('MyDirective')
Would return a hash containing:
foo => 123
bar => abc