Drupal configurations such as .info
, .make
appear to follow common structure. There must be Drupal API for reading these configurations from code.
How does one load and read these configurations in his code?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.
Sign up to join this communityYou want drupal_parse_info_format.
Data should be in an .ini-like format to specify values. White-space generally doesn't matter, except inside values.
key = value
key = "value"
key = 'value'
key = "multi-line
value"
key = 'multi-line
value'
key
=
'value'
Arrays are created using a HTTP GET alike syntax:
key[] = "numeric array"
key[index] = "associative array"
key[index][] = "nested numeric array"
key[index][index] = "nested associative array"
PHP constants are substituted in, but only when used as the entire value. Comments should start with a semi-colon at the beginning of a line.
I actually know this because the Profiler module uses it to parse out its .info
file for profile configurations.