Tuesday 27 August 2024

Drupal 8/9/10 Multisite Setup

 Create Drupal 10 fresh instance with composer command

Below composer command will download latest Drupal version.

composer create-project drupal/recommended-project d10multisite

OR

Below composer command will download Drupal specific version.

composer create-project drupal/recommended-project:10.3.2 d10multisite


Create virtual hosts in xampp

c:\xampp\apache\conf\extra\httpd-vhosts.conf

<VirtualHost *:80>

  ServerName d10multisite.localhost

  ServerAlias www.d10multisite.localhost

  DocumentRoot "C:/xampp/htdocs/d10multisite/web"

  <Directory "C:/xampp/htdocs/d10multisite/web">

    Require all granted

  </Directory>

</VirtualHost>


<VirtualHost *:80>

  ServerName d10multisite-site1.localhost

  ServerAlias www.d10multisite-site1.localhost

  DocumentRoot "C:/xampp/htdocs/d10multisite/web"

  <Directory "C:/xampp/htdocs/d10multisite/web">

    Require all granted

  </Directory>

</VirtualHost>


<VirtualHost *:80>

  ServerName d10multisite-site2.localhost

  ServerAlias www.d10multisite-site2.localhost

  DocumentRoot "C:/xampp/htdocs/d10multisite/web"

  <Directory "C:/xampp/htdocs/d10multisite/web">

    Require all granted

  </Directory>

</VirtualHost>


Add below lines in hosts file

C:\Windows\System32\drivers\etc\hosts

    127.0.0.1 d10multisite.localhost

  127.0.0.1 d10multisite-site1.localhost

  127.0.0.1 d10multisite-site2.localhost


cd sites/

ls

cp example.sites.php sites.php

sites.php :- is a file where we are going to configure how many sites are there and mapped to which domain and mapped to which folder.

edit sites.php

go to the bottom of the file

  $sites["d10multisite.localhost"] = 'default';

  $sites["d10multisite-site1.localhost"] = 'site1';

  $sites["d10multisite-site2.localhost"] = 'site2';

every site is having different settings.php

cd default

    cp example.settings.php settings.php

cd site1

    cp default/default.settings.php site1/settings.php

cd site2

    cp default/default.settings.php site2/settings.php

every site is having different services.yml

// default

    cp default/default.services.yml default/services.yml

// site1

    cp default/default.services.yml site1/services.yml

// site2

    cp default/default.services.yml site2/services.yml

Restart xampp server

check in browser with below urls

    d10multisite.localhost

    d10multisite-site1.localhost

    d10multisite-site2.localhost

Now install Drupal instances with standard profile installation.

Now I have to install module with composer, then run below command

    composer require drupal/devel

It will download module from Drupal.org

Now I have to enable this module on any specific site, run below drush command

drush en devel --uri="d10multisite.localhost"

Tuesday 16 July 2024

Upgrade CKEditor 4 to CKEditor 5

Upgrade CKEditor 4 to CKEditor 5 

The old CKEditor module (which integrates with CKEditor 4) has been removed from core in Drupal 10 and is replaced by a new "CKEditor 5" module that integrates with CKEditor 5. The older version still appears as 'CKEditor' when displayed, such as on the extension page.


Most Drupal sites use CKEditor 4, and must do one of the following:

  1. Switch to CKEditor 5 (strongly recommended), or
  2. Install the CKEditor 4 contributed module, which will be supported until late 2023. Choose this option only if the site has additional Drupal modules installed that provide additional CKEditor 4 plugins with no CKEditor 5 equivalents yet. (Consult the Upgrade coordination for modules providing CKEditor 4 plugins wiki page for the current status.)
            #How to upgrade from CKEditor 4 to CKEditor 5

                1. Upgrade to Drupal 9.4.4 or higher

2. Update modules providing additional CKEditor 4 plugins to the latest release of the major version you're on. Modules that have added CKEditor 5 support should provide support for both CKEditor 4 and 5, and provide an automated upgrade path (for toolbar items and plugin settings) from 4 to 5.

3. Enable the CKEditor 5 module (leave "CKEditor" module enabled) 

4. Converting text formats to use CKEditor 5

1. Go to Text Formats ⮕ Editors in the Drupal Configuration user interface and click "Configure" for each text format.

2. Under Text Editor change selection to "CKEditor 5" and click "Save configuration"

3. Text formats must be updated one at a time. This will automatically migrate your text format configuration to CKEditor 5.

4. Disable (old) "CKEditor" module.

5. Note: This will change your configuration so make sure your export it.

A contributed CKEditor 4 module is available. However, CKEditor 4 is reaching its end-of-life at the end of 2023. The contributed module will receive coordinated security releases alongside Drupal 9 core, and no other maintenance or bug fixes. Once Drupal 9 is end-of-life, core maintainers will no longer provide security coverage for the module.


Therefore, sites should only use the CKEditor 4 module if they use contributed modules extending CKEditor that have not yet been updated to work with CKEditor 5.