-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Drupal 8 Development Cookbook - Second Edition
By :
Why would you want to use a distribution? A distribution is a contributed installation profile that is not provided by Drupal core. Distributions provide a specialized version of Drupal with specific installed modules and themes along with specific configurations (content types, and blocks.) On Drupal.org, when you download an installation profile, it not only includes the profile and its modules but a version of Drupal core, hence the name distribution. You can find a list of all Drupal distributions at https://www.drupal.org/project/project_distribution.
We will follow these steps to download a distribution to use as a customized version of Drupal 8:
profiles folder, there's the installation profile's folder--df.$ composer require "commerceguys/intl: ~0.7" "commerceguys/addressing: ~1.0" "commerceguys/zone: ~1.0" "embed/embed: ~2.2Installation profiles work by including additional modules that are part of the contributed project realm or custom modules. The profile will then define them as dependencies to be installed with Drupal. When you select an installation profile, you are instructing Drupal to install a set of modules on installation.
Demo Framework declares itself as an exclusive installation profile. Distributions that declare this are automatically selected and assumed to be the default installation option. The exclusive flag was added with Drupal 7.22 to improve the experience of using a Drupal distribution (http://drupal.org/node/1961012).
Distributions provide a specialized version of Drupal with specific feature sets, but there are a few items worth discussing.
The current standard for generating a built distribution is the utilization of Drush and makefiles. Makefiles allow a user to define a specific version of Drupal core and other projects (such as themes, modules, and third-party libraries) that will make up a Drupal code base. It is not a dependency management workflow, like Composer, but is a build tool.
If you take a look at the Demo Framework's profile folder, you will see drupal-org.make and drupal-org-core.make. These are parsed by the Drupal.org packager to compile the code base and package it as a .zip or .tar.gz, like the one you downloaded.
As discussed in the first recipe's There's more... section, you can install a Drupal site through the Drush command-line tool. You can instruct Drush to use a specific installation profile by providing it as the first argument.
As of Drush 9, which supports Drupal 8.3+, this section is deprecated. Using Drush to download Drupal core or contributed modules will throw a warning to use Composer instead.
The following command would install the Drupal 8 site using the Demo Framework:
$ cd /path/to/drupal8 $ drush pm-download df$ drush site-install df -db-url=mysql://user:pass@localhost/database
Currently, Drupal.org does not package distributions using Composer, which is why there was an extra step to add dependencies when installing the distribution. Many distributions provide project templates to make scaffolding projects simpler.
For example, the following command will set up a Demo Framework site with docroot as the directory for the web server document root, which contains Drupal 8:
$ composer create-project acquia/df-project dfThe project template is available on Acqua's GitHub at https://github.com/acquia/df-project/.
Another distribution, Open Social, provides a template of its own:
$ composer create-project goalgorilla/social_template
The project template is available at https://github.com/goalgorilla/social_template.
Change the font size
Change margin width
Change background colour