Last updated May 6, 2015. Created on March 4, 2014.
Edited by moshe weitzman, tstoeckler, Kristen Pol, amool. Log in to edit this page.

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. 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:

name: Profile Name
type: profile
description: 'Description of your profile.'
core: 8.x

# Optional: Declare your installation profile as a distribution
# This will make the installer auto-select this installation profile.
# The distribution_name property is used in the installer and other places as
# a label for the software being installed.
distribution:
  name: Distribution Name

# Required modules
dependencies:
  - node
  - history
  - block
  - breakpoint
  - color
  - config
  - comment
  - contextual
  - contact
  - custom_block
  - edit
  - help
  - image
  - menu
  - number
  - options
  - path
  - taxonomy
  - dblog
  - responsive_preview
  - search
  - shortcut
  - toolbar
  - overlay
  - field_ui
  - file
  - rdf
  - views
  - views_ui
  - editor
  - ckeditor

.install file

<?php
/**
* @file
* Install, update and uninstall functions for the spark install profile.
*/

/**
* Implements hook_install().
*
* Perform actions to set up the site for this profile.
*
* @see system_install()
*/
function spark_install() {
  // First, do everything in standard profile.
  include_once DRUPAL_ROOT . '/core/profiles/standard/standard.install';
  standard_install();
 
  // Can add code in here to make nodes, terms, etc.
}

.profile file

<?php
/**
* @file
* Enables modules and site configuration for a standard site installation.
*/

// Add any custom code here like hook implementations.

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

Berdir’s picture

st() no longer exists in Drupal 8, just use t().

I recommend using https://github.com/larowlan/default_content for creating default content in 8.x. But note that happens after hook_install(), so you can't refer to it there. I recommend to put it in a separate module that the install profile depends on.