18.10.2016 Views

Drupal 7 Module Development

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Installation Profiles<br />

'update_status_module' => array(1, 2),<br />

),<br />

),<br />

);<br />

/**<br />

* Root directory of <strong>Drupal</strong> installation.<br />

*/<br />

define(‘DRUPAL_ROOT’, getcwd());<br />

/**<br />

* Global flag to indicate that site is in installation mode.<br />

*/<br />

define(‘MAINTENANCE_MODE’, ‘install’);<br />

// Load the installer and initiate the install process using<br />

// $settings.<br />

require_once DRUPAL_ROOT . '/includes/install.core.inc';<br />

install_drupal($settings);<br />

This script starts by creating a $settings array that provides information for<br />

the installer and the values for the forms within the installer. After the settings<br />

are defined, the installer (includes/install.core.inc) is included and kicked<br />

off by calling install_drupal() with the $settings being passed in.<br />

Summary<br />

We have now completed creating an installation profile. We started by looking at<br />

where to store modules and themes associated with the profile. We then moved on<br />

to creating the install profile, which included creating a new task and altering a task<br />

bundled with <strong>Drupal</strong> core.<br />

Along the way, we looked at how to create content types, enable blocks, and<br />

set variables.<br />

We closed the chapter by looking at how to optimize code placement and looked at<br />

how to execute a <strong>Drupal</strong> installation outside the web-based install wizard.<br />

[ 362 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!