How to Make a Drupal 8 Distribution
Build the content types and taxonomies with fields., Create the needed views., Configure menus, user roles and permissions, etc.,Use dummy content to test the structure., Create a theme for the distribution., Create the profile directory., Export...
Step-by-Step Guide
-
Step 1: Build the content types and taxonomies with fields.
Do this just like you would build a regular Drupal website.
These will all be created your distribution is installed. , Same as above.
Remember to create views that help the administrators / owners of the website manage their content, and put links to them into a menu such as the administration menu., Same as above.,, This will allow you to ensure that the distribution looks great and provides a good user experience out-the-box for its users.
Focus on providing great templates for layout and structure, CSS for look-and-feel, and perhaps even some JavaScript for interactive elements., Inside your website's root directory, there will be a "profiles" directory that is probably empty (or it simply has a README file in it).
Create a directory for your distribution, following Drupal's naming rules (all lowercase, underscores instead of spaces, etc.), This can easily be done from the admin interface (/admin/config/development/configuration), or using Drush or Drupal console.
Once they've been created, copy all the files except core.extension.yml into the a new directory in your profile directory, such as /profiles//config/install/., If the distribution should have any themes and modules available when it is installed
- they don't have to be enabled by default when it is installed
- you can add them to the profile directory.
Themes should go into a "themes" directory, and modules into a "modules" directory.
Don't add any themes or modules that are already on Drupal.org into these folders; Drupal.org will take care of that for you (explained below)., This is very similar to the info files used by themes and modules., These are PHP files that can have functions you want to run, but are used at different times during the installation., This can be in text (.txt) or markdown (.md) format., This is a file that tells Drupal.org how to package or bundle your distribution with other projects (modules, themes, etc.).
For instance, if you want the Pathauto module included as part of the distribution, it simply needs to be in the makefile.
For Drupal 8 distributions, the makefile can be in either "ini" (older) or "yaml" (newer) format.
While "yaml" is the recommended format, some developers have more difficulty getting Drupal.org to accept it without errors.
Creating it is easily done using drush.
The following command will provide the code for this file: "drush make-generate"
Initialise the directory as a git repository, stage all the files, and commit them with a message., This will help other developers that use Github more frequently than Drupal.org support and improve your distribution., To test your distribution, all you need to do is run the install.php file with an empty database.
If you want to use your existing database, make sure you make a backup (dump) of it first., Go to the Create account page and sign up to Drupal.org if you haven't already., Go to drupal.org/project/add, choose "Distribution project"
and fill in the form that follows., When looking at your new project page, click on the "Version control" link at the top.
That page provides instructions on how to push your project to the repository for it on Drupal.org.
Keep in mind that if you've submitted your project to Github already and called that remote "origin"
you'll need to name the Drupal.org remote something else, such as "drupal.org"., When looking at your new project page (or if you're still on the Version Control page), click the "Edit" link at the top, then click on "Releases".
If you committed your project correctly in the previous step, you'll see a "Add new release" link; click it.
From the select field, choose your branch and continue.
Fill in the "Create Release" form.
When you've submitted that form, your distribution will be live and available for anyone to download! You might need to wait a few minutes before the release will show up on your project page, as Drupal.org tests and packages it for download., If the downloadable zip / tar files of your release are small (less than 1 MB), that means Drupal wasn't able to package it correctly, and there's likely an issue with your makefile.
Check that your makefile is correct, then commit and push the project again.
Wait a few minutes for Drupal to re-package it, and check that the download is now several MB., -
Step 2: Create the needed views.
-
Step 3: Configure menus
-
Step 4: user roles and permissions
-
Step 5: Use dummy content to test the structure.
-
Step 6: Create a theme for the distribution.
-
Step 7: Create the profile directory.
-
Step 8: Export and copy the configuration.
-
Step 9: Copy in custom themes and modules.
-
Step 10: Make the info file.
-
Step 11: Add "install" and "profile" files.
-
Step 12: Add a README file.
-
Step 13: Make the makefile file.
-
Step 14: Commit all the files to git.
-
Step 15: (Optional) Submit your distribution to Github.
-
Step 16: Install the distribution.
-
Step 17: Create an account on Drupal.org.
-
Step 18: Fill in the "Create Distribution project" form.
-
Step 19: Commit your repository to the Drupal.org remote.
-
Step 20: Create a new release.
-
Step 21: If the downloadable file is too small
-
Step 22: fix your makefile.
-
Step 23: Download and install the distribution to test it
-
Step 24: if desired.
Detailed Guide
Do this just like you would build a regular Drupal website.
These will all be created your distribution is installed. , Same as above.
Remember to create views that help the administrators / owners of the website manage their content, and put links to them into a menu such as the administration menu., Same as above.,, This will allow you to ensure that the distribution looks great and provides a good user experience out-the-box for its users.
Focus on providing great templates for layout and structure, CSS for look-and-feel, and perhaps even some JavaScript for interactive elements., Inside your website's root directory, there will be a "profiles" directory that is probably empty (or it simply has a README file in it).
Create a directory for your distribution, following Drupal's naming rules (all lowercase, underscores instead of spaces, etc.), This can easily be done from the admin interface (/admin/config/development/configuration), or using Drush or Drupal console.
Once they've been created, copy all the files except core.extension.yml into the a new directory in your profile directory, such as /profiles//config/install/., If the distribution should have any themes and modules available when it is installed
- they don't have to be enabled by default when it is installed
- you can add them to the profile directory.
Themes should go into a "themes" directory, and modules into a "modules" directory.
Don't add any themes or modules that are already on Drupal.org into these folders; Drupal.org will take care of that for you (explained below)., This is very similar to the info files used by themes and modules., These are PHP files that can have functions you want to run, but are used at different times during the installation., This can be in text (.txt) or markdown (.md) format., This is a file that tells Drupal.org how to package or bundle your distribution with other projects (modules, themes, etc.).
For instance, if you want the Pathauto module included as part of the distribution, it simply needs to be in the makefile.
For Drupal 8 distributions, the makefile can be in either "ini" (older) or "yaml" (newer) format.
While "yaml" is the recommended format, some developers have more difficulty getting Drupal.org to accept it without errors.
Creating it is easily done using drush.
The following command will provide the code for this file: "drush make-generate"
Initialise the directory as a git repository, stage all the files, and commit them with a message., This will help other developers that use Github more frequently than Drupal.org support and improve your distribution., To test your distribution, all you need to do is run the install.php file with an empty database.
If you want to use your existing database, make sure you make a backup (dump) of it first., Go to the Create account page and sign up to Drupal.org if you haven't already., Go to drupal.org/project/add, choose "Distribution project"
and fill in the form that follows., When looking at your new project page, click on the "Version control" link at the top.
That page provides instructions on how to push your project to the repository for it on Drupal.org.
Keep in mind that if you've submitted your project to Github already and called that remote "origin"
you'll need to name the Drupal.org remote something else, such as "drupal.org"., When looking at your new project page (or if you're still on the Version Control page), click the "Edit" link at the top, then click on "Releases".
If you committed your project correctly in the previous step, you'll see a "Add new release" link; click it.
From the select field, choose your branch and continue.
Fill in the "Create Release" form.
When you've submitted that form, your distribution will be live and available for anyone to download! You might need to wait a few minutes before the release will show up on your project page, as Drupal.org tests and packages it for download., If the downloadable zip / tar files of your release are small (less than 1 MB), that means Drupal wasn't able to package it correctly, and there's likely an issue with your makefile.
Check that your makefile is correct, then commit and push the project again.
Wait a few minutes for Drupal to re-package it, and check that the download is now several MB.,
About the Author
Carolyn Hall
A passionate writer with expertise in practical skills topics. Loves sharing practical knowledge.
Rate This Guide
How helpful was this guide? Click to rate: