Eight Phases of Drupal 7 Bootstrap

The moment a web browser requests a page, Drupal begins running a complex series of steps that result
in a fully rendered page being returned to the browser. With every page request, Drupal has to do those
same calculations,


Scaling Drupal (Memcached, varnish)

The memcached system saves arbitrary data in random access memory and serves the data as fast
as possible. This type of delivery will perform better than anything that depends on hard disk access.
Memcached stores objects and references them with a unique key for each object. It is up to the
programmer to determine what objects to put into memcached. Memcached knows nothing about the
type or nature of what is put into it; to its eyes, it is all a pile of bits with keys for retrieval.

Create a node type programmatically

Example of writing a node module that lets users add a job posting to a site. A job posting node will include a
title, a body where the details of the job posting will be entered, and a field where the user can enter the
name of the company. For the job posting title and a body, I’ll use the built-in node title and body that
are standard with all Drupal nodes. I’ll need to add a new custom field for the company’s name.
I’ll start by creating a folder named job_post in your sites/all/modules/custom directory.

1. job_post.info file:


Connecting to Multiple Databases Within Drupal 7

While the database abstraction layer makes remembering function names easier, it also adds built-in
security to queries. Sometimes, we need to connect to third-party or legacy databases, and it would be
great to use Drupal’s database API for this need as well and get the security benefits. The good news is
that we can! For example, your module can open a connection to a non-Drupal database and retrieve
In the settings.php file,$databases is an array composed of multiple database connection strings.


Connecting to Drupal 7 database outside of drupal

Drupal automatically establishes a connection to the database as part of its normal bootstrap process, so
you do not need to worry about doing that.
If you are working outside Drupal itself (for example, you’re writing a stand-alone PHP script or
have existing PHP code outside of Drupal that needs access to Drupal’s database), you would use the
following approach.


Integrating external authentication into Drupal 7 login process

Sometimes, you may not want to use Drupal’s local users table. but setting up a Single Sign-on (SSO) system, for example, maybe you already have a
table of users in another database or in LDAP, or using SAML (http://en.wikipedia.org/wiki/Security_Assertion_Markup_Language)


The Schema API

Drupal supports multiple databases (MySQL, PostreSQL, SQLite, etc.) through its database abstraction
layer. Each module that wants to have a database table describes that table to Drupal using a schema
definition. Drupal then translates the definition into syntax that is appropriate for the database.

when you write a module that needs to create one or more database tables for
storage, the instructions to create and maintain the table structure go into an .install file that is
distributed with the module


Creating a Menu Item In Drupal 7

To create a menu item, we’ll use the hook_menu() function. Hook_menu() takes an array of items that are
to be added to a menu, where each item is itself an array of key/value pairs that define the attributes of
the menu item.

Hook_menu() Key/Value Attributes

Hooks, Actions, and Triggers In Drupal 7

Drupal proceeds through a series of events as it goes about its business. These internal events are times
when modules are allowed to interact with Drupal’s processing.

Drupal developers refer to these internal events as hooks because when one of the events occurs,
Drupal allows modules to hook into the path of execution at that point. Typical module development
involves deciding which Drupal event you want to react to, that is, which hooks you want to implement in your module.


All drupal 7 hooks

Allow modules to interact with the Drupal core.

Drupal's module system is based on the concept of "hooks". A hook is a PHP function that is named foo_bar(), where "foo" is the name of the module (whose filename is thus foo.module) and "bar" is the name of the hook. Each hook has a defined set of parameters and a specified result type.

To extend Drupal, a module need simply implement a hook. When Drupal wishes to allow intervention from modules, it determines which modules implement a hook and calls that hook in all enabled modules that implement it.



Subscribe to Front page feed