How to Write a Drupal 8 Installation Profile

This article is being written based on the Spark distribution.

Installation profiles are like modules

All installation profiles must have:

  1. profilename.info.yml
  2. profilename.profile

files, and they can also have a profilename.install file.

The profilename.profile file has access to almost everything a normal Drupal modulename.module file does because Drupal is fully bootstrapped before almost anything in the profile runs. The primary exception is that st() should generally be used to translate strings instead of the usual t() because the localization hasn't been set up until the installation process completes. Profile files should reside in their own directory within the /profiles directory to be loaded.

.info.yml file

The profilename.info.yml file should look similar to this:

Using simplytest.me as a project demo

Evaluate Drupal projects online

Target audience: Drupal project maintainers.

On Drupal project pages you might find a 'Try a demonstration' link to evaluate it. A good project demo is one where you can fiddle with the settings and for this you need to provide admin access in a temporary sandbox. This is where simplytest.me comes in handy by allowing anyone to create a temporary Drupal website with any module, theme or distribution.

How to Create a Drupal Installation Profile with Profiler and Profiler Builder

Profiler provides a cleaner and easier way to create install profiles. Profiler Builder is an extension of the Profiler installation profile simplifier. This module creates a downloadable tar package that gives you a well made installation profile and associated drush make file based on the site its installed on.

Training

Training is a Drupal distribution for building Drupal based training websites / portal which brings together information about diverse courses (Drupal, PHP, Soft Skills, Personality Development etc.) in a unified way.

Training distribution contains most of the modules and basic configuration (content-types, views, features) you would need to create a training portal.

The core features of Training include :

  • Inbuilt Roles - Trainer, Trainee.
  • Inbuilt Vocabulary – Courses.
  • Inbuilt Content Types - Course Topic, Course SubTopic, Course Assignments, Training, Training-Calender.
  • Inbuilt Block – Courses taxonomy-view.
  • Inbuilt Views - Calendar, Courses Listing, Topic-SubTopic Listing.
  • Each course has a dedicated page, listing topic - sub topics with links having detailed description.
  • The most interesting feature of this distribution is that Trainer can upload multiple videos, pdfs, documents under Course Topic and Course Sub-topic which Trainees can watch / read whenever they want.
  • Trainers can schedule the trainings on various courses / topics / sub-topics with the help of Training-Calender content-type.
  • Customizable home page with calendar view displaying all the scheduled trainings.

installing Distributions on Quickstart

Instructions for installing distributions / installation profiles on your Quickstart machine.

Using Drupal Commons as an example

Managing Drush make files for an installation profile

Drush make is a powerful tool for assembling all the dependencies needed for an installation profile to work as a full Drupal website. It is included as part of Drush as of Drush version 5. It is the central tool used for Packaging a distribution on Drupal.org.

However, to build a fully functional site including the installation profile code itself, things get a bit complicated. You need multiple .make files that work together.

drupal-org.make

This file defines all of the contributed modules, themes, and 3rd party libraries used by the installation profile. This file will be used in a few circumstances:

  1. When the Drupal.org packaging script builds distribution releases of the installation profile.
  2. When drush make builds the installation profile recursively. More on this below.

A trivial example might look something like this:

api = 2
core = 7.x
projects[views] = 3.3
projects[ctools] = 1.0-rc1

For more details, see Full example drupal-org.make file.

drupal-org-core.make

Pages

Subscribe with RSS Subscribe to RSS - Installation Profile