Drupal8 Development Tutorial: Understanding. info.yml Files

Source: Internet
Author: User
Tags drupal

YAML files are the newly introduced important project files, and in Drupal 8, whether it's a module, a theme, or a setup profile, you'll need a. info.yml file to store the underlying information about the project.

In Drupal,. info.yml files are typically used for the following purposes:

    • Declaring the existence of modules, themes, installation profiles to Drupal
    • Providing information to the Drupal Web management interface
    • Provides module start, disable conditions, and version compatibility information
    • Other management uses

Hello World Example

Here is a simple hello_world.info.yml file, you can create a new Hello_world directory under the Local module directory (/modules/custom or/sites/all/modules/custom), and will contain the contents below to The hello_world.info.yml file is placed in the module directory:

name: Hellow World Module
description: Creates a page showing “Hello World”
package: Example

type: module 
core: 8.x

    • The first three lines of information in the code are used in the module management interface, which is visible to users when they enable or disable the module. Where name and description are required , each represents the name and description of the module.
    • The package is optional to set the grouping information for the module.
    • Type is a new "required" message in Drupal 8 that declares the type of project, such as module, theme or profile (modules, themes, or installation configuration packages)
    • The core is used to set the version information of the Drupal kernel so that Drupal confirms the version of Drupal that this project is compatible with.

Complete example

In addition to the property settings in the example above, the project information file contains some other optional properties, which can be referenced in the following code:

name: Hello World Module
description: Creates a page showing "Hello World".
package: Custom

type: module
core: 8.x

dependencies:
  - datetime
  - link
  - views

configure: hello_world.settings

hidden: true

# Note: do not add the ‘version‘  property yourself!
# It will be added automatically by the packager on drupal.org.
version: 1.0

The configuration items in the Yaml file are semantically sufficient to literally understand their meaning. If you've had Drupal-related development experience, it's easier to understand the YAML configuration files in Drupal 8.

Original title: Drupal8 Development Tutorial: Understanding. info.yml File

Original address: http://drupalct.org/drupal-development/learn-drupal8-info-yaml-file.html

Drupal8 Development Tutorial: Understanding. info.yml Files

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.