D7 - Introduction to Module Development

Introduction

Blanca Esthela Esqueda Gutierrez

Senior Software Engineer & Drupal Grand Master

OPIN Software

What we will discuss today...

  • Overview of Module Development
  • Helpful Tools
  • Installing and Configuring the Devel Module
  • Overview of the Drupal API
  • Anatomy of a Drupal module
  • Understanding .info file
  • Event-Driven Hook System
  • Introduction to hook_help()
  • Overview of the Block API
  • Introduction to hook_block_info() and hook_block_view()
  • Overview of System API
  • Introduction to hook_permission() and user_access()
  • Drupal Coding Standards
  • Tools for Coding Standards Review

Overview of Module Development

Overview of Module Development

Overview of Module Development

Overview of Module Development

Overview of Site Building

Overview of Site Building

Helpful Tools

https://www.acquia.com/products-services/dev-desktop

Acquia dev-desktop

Drush

Git

Code editor

Terminal

MAMP

Drupal 

Helpful Tools

Acquia dev-desktop

Installing and Configuring the Devel Module

Development Block

Switch User Block

Execute PHP Block

Tab to Inspect Objects and Variables

dsm, kpr

Query Log

Overview of the Drupal API

● Drupal API Documentation: http://api.drupal.org

● Drupal Examples Module: https://drupal.org/project/examples

● Batch API: https://drupal.org/node/180528

● Cache API: https://drupal.org/node/145279

● Entity API: https://drupal.org/developing/api/entity/7

● Field API: https://drupal.org/node/443536

● File API: https://drupal.org/node/555118

● Form API: https://drupal.org/node/37775

● Queue API:

https://api.drupal.org/api/drupal/modules!system!system.queue.inc/group/queue/7

● Common core hooks: https://drupal.org/comment/3560674#comment-3560674

Anatomy of a Drupal module

Core Modules

Sites directory

sites/all/modules/contrib

sites/all/modules/custom

Two files required

mymodule.info

mymodule.module

Optional files

README.txt

HTML Templates, CSS
mymodule.install

Understanding .info file

Name = Demo
Description = Just a demo module
Core = 7.x

Understanding .module file

<?php
//Put your functions here

Event-Driven Hook System

Drupal is "Event-Driven"
How to hook into Drupla processes

What it is an Event?

What it is a Hook?

https://www.computerminds.co.uk/articles/rendering-drupal-7-fields-right-way

Introduction to hook_help()

Introduction to hook_block_info()
and hook_block_view()

https://www.unleashed-technologies.com/blog/2014/01/15/beginning-drupal-module-development-custom-drupal-blocks-tutorial

Introduction to hook_permission()

and user_access()

Drupal Coding Standards

● Drupal Coding Standards: https://drupal.org/coding-standards

● Naming your modules, functions, and variables: https://drupal.org/node/299070

 

Tools for Coding Standards Review

Helper Modules

https://www.drupal.org/coding-standards#helpermod

D7 Module Development

By besqueda

D7 Module Development

Overview of D7 Module Development

  • 742