Patch for compatibility this module with Drupal 9 will be provided.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

iamdroid created an issue. See original summary.

iamdroid’s picture

Provided patch works with patch from #2648496 and should be applied after it.

iamdroid’s picture

StatusFileSize
new2.3 KB

Patch updated, replaced deprecated entity.manager

tuthanh’s picture

#3 seems to work. Thanks iamdroid.

Pooja Ganjage’s picture

Hii,

This patch works for me.

Thanks

Pooja Ganjage’s picture

santhosh-kumar-rengasamy’s picture

I have created this patch for Drupal 9 compatibility on development version 8.x-1.x-dev.
This patch having the consolidated code from the issues Drupal 9 Compatibility and Not working in Drupal 8 - Filter not Visible.

Please review the patch.

ricardochefigueroa’s picture

#3 worked. Thanks!

retiredpro made their first commit to this issue’s fork.

john_b’s picture

StatusFileSize
new9.38 KB

The following does not pick up custom blocks.

        $replacement = '';
        if (\Drupal::service('entity_type.manager')->getStorage('block')->load($block_id)) {
         $block = \Drupal::service('entity_type.manager')->getStorage('block')->load($block_id);
          $block_view = \Drupal::service('entity_type.manager')
            ->getViewBuilder('block')
           ->view($block);
          $replacement = \Drupal::service('renderer')->render($block_view);
        }

Add code as follows:

        $replacement = '';
        // Render blocks in code.
        if (\Drupal::service('entity_type.manager')->getStorage('block')->load($block_id)) {
          $block = \Drupal::service('entity_type.manager')->getStorage('block')->load($block_id);
          $block_view = \Drupal::service('entity_type.manager')
            ->getViewBuilder('block')
            ->view($block);
          $replacement = \Drupal::service('renderer')->render($block_view);
        }
        // Render custom blocks.
        if (\Drupal::service('entity_type.manager')->getStorage('block_content')->load($block_id)) {
          $block = \Drupal::service('entity_type.manager')->getStorage('block_content')->load($block_id);
          $block_view = \Drupal::service('entity_type.manager')
            ->getViewBuilder('block_content')
            ->view($block);
          $replacement = \Drupal::service('renderer')->render($block_view);
        }

I am finding the git repo confusing to work with. A patched module with modified README.txt is attached. It seems to be working on D9 for both code and custom blocks.

john_b’s picture

Note the above relies on using the machine name of a block instance. Therefore a custom block created with a plugin should be placed, and if necessary disabled, and the machine name of the block instance used. To display a block created by a plugin using the block's id in the annotation, something based on https://drupal.stackexchange.com/questions/171686/how-can-i-programmatic... works. This should be documented in README.

hotwebmatter made their first commit to this issue’s fork.

summit’s picture

Hi,

Patch Comment#7 doesn't work anymore with latest Insert_Bock using Composer
insert_block-d9-compatibility-3151591-7.patch

Last comment changing composer json worked!

Thanks for building!

greetings, Martijn

sébastien-fr’s picture

Hello, in comment #13, for D9, it is explained to add :

"url": "https://packages.drupal.org/9",

But it returns this error :

[Composer\Downloader\TransportException]                                                            
  The "https://www.drupal.org/9/packages.json" file could not be downloaded (HTTP/1.1 404 Not Found) 

Are you sure we can do this ? In other D9 projects, I still see

"repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ],
john_b’s picture

Sometimes the "file could not be downloaded" error with composer results from using composer version 1 rather than composer 2.

akozoriz’s picture

Version: 8.x-1.x-dev » 8.x-1.0-beta1
Assigned: Unassigned » akozoriz
Status: Needs review » Fixed

Drupal 9 compatible 8.x-1.0-beta1 is released.

  • akozoriz committed df5d74f on 8.x-1.x
    Issue #3151591 by retiredpro, hotwebmatter, iamdroid, John_B, Santhosh-...
hotwebmatter’s picture

@vinyl_roads -- You are correct, merci. There is no Composer endpoint for Drupal 9 packages, we still use the one for Drupal 8. I made so many of these Issue Forks, and most of them have the correct endpoint, but this one slipped through the cracks. Fixing it now!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.