3

Here's my problem: I use profiler builder to generate a profile from an installation. But the fact is : the profile only list my modules.

What I want my profile to do is also to keep my Drupal configuration. For exemple, if I generate the profile of a drupal installation with a WYSIWYG installed and configured, I want the profile to keep this configuration and reload it to new instance (created with the profile).

Is it possible ? Thanks.

  • You have access to the database in an install profile so yes, absolutely, you can store any config you want to. The exact method for that will vary wildly depending on the module whose config you're dealing with, and of course there's no automated solution for it – Clive Oct 9 '13 at 8:24
  • you could use the features module to export many of the configurations. but all the modules are not supported I guess. – Mohammed Shameem Oct 9 '13 at 8:28
  • @Clive : If I get it, all I have to do is find a way to programmatically set the drupal configs I want to in my profile hook install ? – Alarid Oct 9 '13 at 8:32
  • 2
    Exactly right - for the most part config lives in the database in Drupal 7, so it's just a matter of finding the right combination of SQL statements. The Configuration Management module might also be of interest – Clive Oct 9 '13 at 9:01
2

Many configuration elements can be exported and imported using Features module.

Features provides a UI and API for taking different site building components from modules with exportables and bundling them together in a single feature module. A feature module is like any other Drupal module except that it declares its components (e.g. views, contexts, CCK fields, etc.) in its .info file so that it can be checked, updated, or reverted programmatically.

Problem is that it only accepts modules that exports their configurations with Chaos tools style, so you can't export blocks, but can export boxes, and so on. Wysiwyg has currently ctools commented out from it's requirements, so you will need to see if it can be exported or not, at it's current stage of development.

If configuration is kept in system variables, you could consider using Strongarm:

Strongarm gives site builders a way to override the default variable values that Drupal core and contributed modules ship with. It is not an end user tool, but a developer and site builder tool which provides an API and a limited UI.

As Clive pointed out, there is also Configuration Management module:

For the most part this module provides the same functionality as a subset of the features module.

The main difference is - it packs only configuration, is smaller and easier to handle, and was written explicitly to deal with "the shortcomings of using features module for configuration management". Still, you are moving whole page, so features with their broader goal might be the way. Your choice.

In all other cases you need to figure out how module stores it's configuration and data, and interact directly with database from your installation profile.

  • Thanks for your answer, I'll take a look at these tools :) – Alarid Oct 9 '13 at 8:50
0

I) As mentioned before, you can use Features module, this is what I'm doing now. I have packed some configurations into a submodule of my profile which I enable automatically by declaring it as a dependency.

II) A second option is this one mentioned in Drupal.org: https://www.drupal.org/docs/8/creating-distributions/how-to-write-a-drupal-8-installation-profile

In Configuration paragraph:

Drupal 8 installation profiles can contain configuration files. You can start by taking the configuration directory (config folder) of an installed, configured site and copying it into the config/install folder in your profile.

Once that's in place, there are some other required tasks (...)

If you just want to grab an existing site's configuration, and don't need to end up with a formal installation profile (...), you can use the Configuration Installer installation profile to install a new site from the configuration of another site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.