Drupal 7 module. info file Introduction

Source: Internet
Author: User
Tags drupal

Drupal uses the. info file to save the basic data about theme and modules (metadata ).

Encoding: UTF-8 is recommended, that is, BOM (byte order mark) is not included ).

The following is an example of. info.

name = Really Neat Widgetdescription = Provides a really neat widget for your site's sidebar.core = 7.xpackage = Viewsdependencies[] = viewsdependencies[] = panelsfiles[] = tests/example.testconfigure = admin/config/content/example

Its attributes include:

  • NameRequired
  • Description recommendation
  • CoreRequired
  • Stylesheets
  • Scripts
  • Files
  • Dependencies
  • Package
  • PHP
  • Version is not encouraged
  • Configure
  • Required
  • Hidden
  • Project is not encouraged and is only suitable for encapsulation.
  • The project status URL is used only for custom modules that are not submitted to drupal.org.

Explanations:

Name (required)

This will display the module name, which is highly readable. Do not write it as really_neat_widget here

name = Really Neat Widget

Description (recommended)

It is best to write a line to briefly describe the purpose of the module.255 characters at most.

description = Provides a really neat widget for your site's sidebar.

The description can contain links, so that users can easily link to the specified page to learn more about the module information and usage.

description = Domain manager by <a href="http://petermoulding.com">Peter Moulding .com</a>.

Core (required)

The Drupal version that applies to your template. If Drupal 7 is used, write 7.x. Note that the version cannot be a sub-version. Incorrect write 7.12

core = 7.x

Stylesheets (optional)

If you need a CSS file for each page, Drupal 7 allows you to add it here. For the format, see. info in theme.

stylesheets[all][] = node.css

Scripts (optional)

If you need JavaScript files for each page, you can add them here.

scripts[] = somescript.js

For more information, refer to the Javascript Management in Drupal 7.

Files (optional)

Drupal now supports dynamic loading of the Code registry. To support this function, all modules must preread the code files that contain Class and interface declarations in the. info file.

files[] = tests/example.test
When a module is enabled, Drupal will re-scan the files declared in all files and index all the classes and interfaces that can be found ). When a class is accessed for the first time, it is automatically loaded by PHP.

Dependencies (optional)

Supported by other modules

dependencies[] = viewdependencies[] = panels

Note: although only the module view and panels are used here, they will use the module chaos tools, so they will be automatically added.

If you want to specify a module that requires a specific version, you can use the following expressions:

dependencies[] = modulename (major.minor)

Major is a number that represents the primary version number. Minor can be a number or a letter that represents the secondary version number .. X indicates any version number. Example

dependencies[] = exampleapi (1.x)test_dependencies[] = autoload (>7.x-1.5)

In the above example, the module installs example API motherboard 1, any times the version number module (such as 1.0, 1.1, 1.2-beta4 etc .)

The dependencies [] attribute in the. info file also allows you to select a specified version.

  • = OR = equal to (Optional: equal sign by default)
  • > Greater
  • <Less
  • > = Equal to or greater
  • <= Small equals
  • ! = Not equal

Version greater than 1.0

dependencies[] = exampleapi (>1.0)

The version number must be 7.x compatible and greater than 1.5.

dependencies[] = exampleapi (>7.x-1.5)

Multi-version dependency is also supported, separated by commas

dependencies[] = exampleapi (>1.0, <=3.2, !=3.0)

You can also use the system as the module name to specify the minimum Drupal core version. This module runs at least in Drupal 7.53.

dependencies[] = system (>=7.53)

Package (optional)

It is categorized into modules for easy search. If it is not written, it will be in others. Note that it is case sensitive. Views and views are two types. Punctuation should not be used here.

package = Views


PHP (optional)

Specifies the PHP version with the lowest template running

php = 5.3

For example, this indicates that the module cannot run in versions earlier than 5.3. If not written, it is the same version as Drupal. Sometimes some features of the new version of PHP are used. When the module needs to use a version that is newer than the core requirement, it will be commented here.

Version (not encouraged)

If the module is published to drupal.org, they will give you a version number string. If you only write it by yourself, you can write the desired version number or do not write it.

Because I wrote it myself and didn't give the version number, it is empty.

Configure (optional)

Shows the path of the module configuration page. When the module is opened, the "configuration re" and "permission" links are displayed. This link goes to the module configuration overview page.

configure = admin/config/content/example

Click confirgure to jump to admin/config/content/example and configure this module.

Required (optional)

If the module must not be closed, write:

required = TRUE
These modules are automatically enabled when Drupal is installed ). This generally uses the core modules of Drupal (such as node and user)

Hidden (optional)

Set if the module or topic is invisible

hidden = TRUE

This is generally used in the test module.

Project (not encouraged, only applicable for encapsulation)

Module maintenance personnel cannot use this attribute. When the code is uploaded to drupal.org, they will automatically allocate strings here. This setting is mainly used in combinationUpgrade status(Update Status) module, so that you can monitor the version upgrade and remind the Administrator to use the new version.

Project Status URL (used only for custom modules not submitted to drupal.org)

Allows module maintenance personnel to define a URLUpgrade status(Update Status) module to check whether they need to be upgraded. If the module is not released on drupal.org, define the parameters here. The URL should point to an XML format, which should be placed at http://my.domain.com/projects/?project=/#core}. In this example,

project status url = http://my.domain.com/projects

Reference and made changes: https://www.drupal.org/node/542202

Zookeeper

Drupal 7 module. info file Introduction

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.