Extending and altering Drupal

Extending and altering Drupal

Overview of extensions and alteration methods for Drupal.

Types of extensions

Drupal's core behavior can be extended and altered via these three basic types of extensions:

  • Themes: Themes alter the appearance of Drupal sites. They can include template files, which alter the HTML markup and other raw output of the site; CSS files, which alter the styling applied to the HTML; and JavaScript, Flash, images, and other files. For more information, see the Theme system and render API topic and https://www.drupal.org/theme-guide/8
  • Modules: Modules add to or alter the behavior and functionality of Drupal, by using one or more of the methods listed below. For more information about creating modules, see https://www.drupal.org/developing/modules/8
  • Installation profiles: Installation profiles can be used to create distributions, which are complete specific-purpose packages of Drupal including additional modules, themes, and data. For more information, see https://www.drupal.org/developing/distributions.

Alteration methods for modules

Here is a list of the ways that modules can alter or extend Drupal's core behavior, or the behavior of other modules:

  • Hooks: Specially-named functions that a module defines, which are discovered and called at specific times, usually to alter behavior or data. See the Hooks topic for more information.
  • Plugins: Classes that a module defines, which are discovered and instantiated at specific times to add functionality. See the Plugin API topic for more information.
  • Entities: Special plugins that define entity types for storing new types of content or configuration in Drupal. See the Entity API topic for more information.
  • Services: Classes that perform basic operations within Drupal, such as accessing the database and sending email. See the Dependency Injection Container and Services topic for more information.
  • Routing: Providing or altering "routes", which are URLs that Drupal responds to, or altering routing behavior with event listener classes. See the Routing and menu topic for more information.
  • Events: Modules can register as event subscribers; when an event is dispatched, a method is called on each registered subscriber, allowing each one to react. See the Events topic for more information.

*.info.yml files

Extensions must each be located in a directory whose name matches the short name (or machine name) of the extension, and this directory must contain a file named machine_name.info.yml (where machine_name is the machine name of the extension). See \Drupal\Core\Extension\InfoParserInterface::parse() for documentation of the format of .info.yml files.

File

core/core.api.php, line 1215
Documentation landing page and topics, plus core library hooks.

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!core.api.php/group/extending/8.1.x

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部