Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\Core\Extension;
|
Chris@0
|
4
|
Chris@0
|
5 /**
|
Chris@0
|
6 * Interface for classes that parses Drupal's info.yml files.
|
Chris@0
|
7 */
|
Chris@0
|
8 interface InfoParserInterface {
|
Chris@0
|
9
|
Chris@0
|
10 /**
|
Chris@0
|
11 * Parses Drupal module, theme and profile .info.yml files.
|
Chris@0
|
12 *
|
Chris@0
|
13 * Info files are NOT for placing arbitrary theme and module-specific
|
Chris@0
|
14 * settings. Use Config::get() and Config::set()->save() for that. Info files
|
Chris@0
|
15 * are formatted as YAML. If the 'version' key is set to 'VERSION' in any info
|
Chris@0
|
16 * file, then the value will be substituted with the current version of Drupal
|
Chris@0
|
17 * core.
|
Chris@0
|
18 *
|
Chris@0
|
19 * Information stored in all .info.yml files:
|
Chris@0
|
20 * - name: The real name of the module for display purposes. (Required)
|
Chris@0
|
21 * - description: A brief description of the module.
|
Chris@0
|
22 * - type: whether it is for a module or theme. (Required)
|
Chris@0
|
23 *
|
Chris@0
|
24 * Information stored in a module .info.yml file:
|
Chris@0
|
25 * - dependencies: An array of dependency strings. Each is in the form
|
Chris@0
|
26 * 'project:module (versions)'; with the following meanings:
|
Chris@0
|
27 * - project: (optional) Project shortname, recommended to ensure
|
Chris@0
|
28 * uniqueness, if the module is part of a project hosted on drupal.org.
|
Chris@0
|
29 * If omitted, also omit the : that follows. The project name is currently
|
Chris@0
|
30 * ignored by Drupal core but is used for automated testing.
|
Chris@0
|
31 * - module: (required) Module shortname within the project.
|
Chris@0
|
32 * - (versions): Version information, consisting of one or more
|
Chris@0
|
33 * comma-separated operator/value pairs or simply version numbers, which
|
Chris@0
|
34 * can contain "x" as a wildcard. Examples: (>=8.22, <8.28), (8.x-3.x).
|
Chris@0
|
35 * - package: The name of the package of modules this module belongs to.
|
Chris@0
|
36 *
|
Chris@0
|
37 * See forum.info.yml for an example of a module .info.yml file.
|
Chris@0
|
38 *
|
Chris@0
|
39 * Information stored in a theme .info.yml file:
|
Chris@0
|
40 * - screenshot: Path to screenshot relative to the theme's .info.yml file.
|
Chris@0
|
41 * - engine: Theme engine; typically twig.
|
Chris@0
|
42 * - base theme: Name of a base theme, if applicable.
|
Chris@0
|
43 * - regions: Listed regions.
|
Chris@0
|
44 * - features: Features available.
|
Chris@0
|
45 * - stylesheets: Theme stylesheets.
|
Chris@0
|
46 * - scripts: Theme scripts.
|
Chris@0
|
47 *
|
Chris@0
|
48 * See bartik.info.yml for an example of a theme .info.yml file.
|
Chris@0
|
49 *
|
Chris@17
|
50 * For information stored in a profile .info.yml file see
|
Chris@17
|
51 * install_profile_info().
|
Chris@17
|
52 *
|
Chris@0
|
53 * @param string $filename
|
Chris@0
|
54 * The file we are parsing. Accepts file with relative or absolute path.
|
Chris@0
|
55 *
|
Chris@0
|
56 * @return array
|
Chris@0
|
57 * The info array.
|
Chris@0
|
58 *
|
Chris@0
|
59 * @throws \Drupal\Core\Extension\InfoParserException
|
Chris@0
|
60 * Exception thrown if there is a parsing error or the .info.yml file does
|
Chris@0
|
61 * not contain a required key.
|
Chris@17
|
62 *
|
Chris@17
|
63 * @see install_profile_info()
|
Chris@0
|
64 */
|
Chris@0
|
65 public function parse($filename);
|
Chris@0
|
66
|
Chris@0
|
67 }
|