Posts

Showing posts from April, 2018

Drupal8 installation profiles and distributions - notes

The installation profile is optional during the installation. If a installation profile is marked as distribution then it is always run during the installation. example installation profile https://github.com/rakeshjames/example_profile How to create an install profile. http://www.thecarneyeffect.co.uk/creating-installation-profile https://github.com/drupal-cod/cod_kickstart Simple use case:  If the site is installed with install profile 'innovation' then media module is enabled and content type 'project' is created. Steps: a) source site 1. Install Drupal8 (source_d8) 2. Enable media module 3. Create a content type called 'project' 4. Export all the configuration - drush cex If you installed Drupal8 via composer-template then the configuration files are here. yourinstall/config/sync/install b) target site: 1. Install Drupal8 (target_d8) 2. Create a profile using drupal console (if necessary) target_d8 > drupal generate:profile  \ ...

How to override a routing and controller in Drupal8

When using below module this is what happens 1. /user/login => page not found 2. /login1234 => shows login page (user.login route is hijacked by this modules route subscriber) 3. /login1234 => shows text "hello world" (user.login controller is hijacked by this modules route subscriber) example_module.info.yml name: 'example_module' type: module description: 'My Awesome Module' core: 8.x package: 'Custom' example_module/example_module.services.yml services:   example_module.route_subscriber:     class: Drupal\example_module\Routing\RouteSubscriber     tags:       - { name: event_subscriber } example_module/ example_module.module <?php /**  * @file  * Contains example_module.module.  */ use Drupal\Core\Routing\RouteMatchInterface; /**  * Implements hook_help().  */ function example_module_help($route_name, RouteMatchInterface $route_match) {   switch ($route_name) {...

Drupal console hacks

drupal generate:routesubscriber  \ --module="example_module"  \ --name="example_module.route_subscriber"  \ --class="RouteSubscriber"

Install drupal using drupal-composer

Step1: Download Drupal8 and its dependencies using composer >sudo composer create-project drupal-composer/drupal-project:~8.5 drupal85 --stability dev --no-interaction This will install drush and drupal-console Reference: https://www.drupal.org/docs/develop/using-composer/using-composer-to-manage-drupal-site-dependencies Step2: Install Drupal using Drush drupal85> sudo vendor/bin/drush site-install --db-url=mysql://username:password@host/dbname For the record: - 8.x-dev is already referring to the version of the project template, the --stability dev is redundant, has been removed in the mean time. - drupal-composer/drupal-project doesn't come in a stable version. The only one available is dev.  - the project template flavor doesn't say anything on what will be required upon install. You need to check composer.json on version constraints  for that. - there are other project templates that do release specific versions. You wouldn't provide the version c...

Multisite Drupal reference

Memcache support for multisites: for each site settings.php add the following line. $conf['memcache_key_prefix'] = 'mysite1';