Change record status: 
Project: 
Introduced in branch: 
8.x
Description: 

All of our old .info files have been converted to YAML and the old .info parser has been removed. The new parser is the Symfony YAML component. The new file extension is .info.yml. This applies to modules, themes, and profiles.

Online documentation: Let Drupal 8 know about your module with an .info.yml file.

Overview

Syntax

  • For the most part, change all = to :.
  • For arrays (e.g. dependencies[] = node), use the following format in drupal 8:
    dependencies:
      - drupal:node
    
  • Note the use of the {project}:{module} format now required for core and contrib modules.

  • In drupal 7 we use ; for Comments And now in drupal 8 we use # for Comments.

More information on the YAML file format

New required 'type' key

A new type key is now required with values that indicate the type of extension. Use module, theme or profile. For example:

type: module

Remove files[] entries

Remove any files[] entries. Classes are now autoloaded using a separate mechanism: PSR-4 compatible class loader in core

Convert configure links to route names

In Drupal 8, specify the administrative configuration link using the route name instead of the system path.

Drupal 7

configure = admin/config/system/actions

Drupal 8

configure: action.admin

More information on the new routing system: hook_menu() has been replaced by new routing system

Examples

For a theme

Drupal 7

name = Bartik
description = A flexible, recolorable theme with many regions and a responsive, mobile-first layout.
package = Core
version = VERSION
core = 7.x

; Stylesheets
stylesheets[all][] = css/layout.css
stylesheets[all][] = css/style.css
stylesheets[all][] = css/colors.css
stylesheets[print][] = css/print.css

; Regions
regions[header] = Header
regions[help] = Help
regions[page_top] = Page top
regions[page_bottom] = Page bottom
regions[highlighted] = Highlighted

regions[featured] = Featured
regions[content] = Content
regions[sidebar_first] = Sidebar first
regions[sidebar_second] = Sidebar second

regions[triptych_first] = Triptych first
regions[triptych_middle] = Triptych middle
regions[triptych_last] = Triptych last

regions[footer_firstcolumn] = Footer first column
regions[footer_secondcolumn] = Footer second column
regions[footer_thirdcolumn] = Footer third column
regions[footer_fourthcolumn] = Footer fourth column
regions[footer] = Footer

; Settings
settings[shortcut_module_link] = 0

Drupal 8

name: Bartik
type: theme
description: 'A flexible, recolorable theme with many regions and a responsive, mobile-first layout.'
package: Core
version: VERSION
core: 8.x

# Stylesheets
stylesheets:
  all:
    - css/layout.css
    - css/style.css
    - css/colors.css
  print:
    - css/print.css

# Regions
regions:
  header: Header
  help: Help
  page_top: 'Page top'
  page_bottom: 'Page bottom'
  highlighted: Highlighted
  featured: Featured
  content: Content
  sidebar_first: 'Sidebar first'
  sidebar_second: 'Sidebar second'
  triptych_first: 'Triptych first'
  triptych_middle: 'Triptych middle'
  triptych_last: 'Triptych last'
  footer_firstcolumn: 'Footer first column'
  footer_secondcolumn: 'Footer second column'
  footer_thirdcolumn: 'Footer third column'
  footer_fourthcolumn: 'Footer fourth column'
  footer: Footer

# Settings
settings:
  shortcut_module_link: '0'

Example for Module

Drupal 8

hal.info.yml file

name: 'HAL'
type: module
description: 'Serializes entities using Hypertext Application Language.'
package: Web services
version: VERSION
core: 8.x
dependencies:
  - drupal:rest
  - drupal:serialization
Impacts: 
Module developers
Themers