When I construct unattended installation using for instance:
drush site-install my_inst_profile \
--account-mail='helpdesk@acme.com' \
--account-name='siteadm' \
--account-pass='sitepass' \
--db-su='dbadm' \
--db-su-pw='dbpass' \
--db-url='mysql://drupal:drupal@mysqldb/drupal' \
--locale='pl' \
--site-mail='site@acme.com' \
--site-name='MY Site' \
--yes
and even the simplest possible installation profile my_inst_profile.info.yml
, my_inst_profile.install
and my_inst_profile.profile
taken directly from How to write a Drupal 8 installation profile, the resulted installation is malfunctioning.
The symptoms are as follows:
- Lack of the middle part of the GUI
- No administrator role in the resulted system
- Stark theme used as a default one even if
info.yml
file indicates any other theme.
It is relatively easy to handle 2 and 3 using:
drush role-create 'administrator'
drush config-set user.role.administrator is_admin true
and
drush pm-enable seven --yes
drush config-set system.theme admin seven --yes
respectively. But the first one exceeds my Drupal capabilities.
There is some discussion and an issue queued on the net (see Adding translations to installation profile upon installation), but the proposals are no longer valid, as there is no /includes/locale.inc and even locale_add_language()
, in Drupal 8.
Does anybody have any hints, on how to bring together ambition to use custom distribution with necessity to build localized site?
Addendum 1
Here is my_inst_profile.info.yml
name: my_inst_profile
type: profile
description: 'Installation profile dedicated for ACME company.'
core: 8.x
distribution:
name: ACME Installation Profile
# Required modules
dependencies:
- node
- history
- block
- block_content
- breakpoint
- color
- config
- comment
- contextual
- contact
- quickedit
- help
- image
- options
- path
- taxonomy
- dblog
- search
- shortcut
- toolbar
- field_ui
- file
- rdf
- views
- views_ui
- editor
- ckeditor
themes:
# - bartik
- seven
# - stark
Here is my_inst_profile.install
<?php
/**
* @file
* Install, update and uninstall functions for the profilename install profile.
*/
/**
* Implements hook_install().
*
* Perform actions to set up the site for this profile.
*
* @see system_install()
*/
function my_inst_profile_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.
}
Here is my_inst_profile.profile
<?php
/**
* @file
* Enables modules and site configuration for a standard site installation.
*/
use Drupal\Core\Form\FormStateInterface;
function my_inst_profile_form_install_configure_form_alter(&$form, FormStateInterface $form_state) {
$form['site_information']['site_name']['#default_value'] = 'MY Site';
$form['site_information']['site_mail']['#default_value'] = 'helpdesk@acme.com';
$form['admin_account']['account']['name']['#default_value'] = 'siteadm';
$form['admin_account']['account']['mail']['#default_value'] = 'helpdesk@acme.com';
$form['regional_settings']['site_default_country']['#default_value'] = 'PL';
$form['regional_settings']['date_default_timezone']['#default_value'] = 'Europe/Warsaw';
}
// Add any further custom code here like hook implementations.
As I mentioned at the beginning, this is just a starting point for further installation profile development.