Cannot add a second TOC.js block instance

Created on 12 August 2024, 4 months ago
Updated 15 August 2024, 4 months ago

Problem/Motivation

We use the Paragraphs TOC module blocks on the page: 1 for wide viewports and another for narrow - we use Bootstrap visibility classes to control which one shows and it all works very nicely.

The wide one services h1,h2,h3 and the narrow one sercives only h1.

However, I can see now that using Toc.js will give several advantages for us but sadly we cannot currently place two Toc.js blocks on the page becasue the module does not seem to provided a unique ID for the instances, when attempting ...

Drupal\Core\Entity\EntityStorageException: 'block' entity with ID 'bit_by_bit_toc.jsblock' already exists. in Drupal\Core\Entity\EntityStorageBase->doPreSave() (line 519 of C:\Users\nick\Sites\bit-by-bit.org\public_html\core\lib\Drupal\Core\Entity\EntityStorageBase.php).

Can anyone help guide us here - are we approaching this wrong or should the module always routinely use inuqie IDs?

We are really very keen to move to this module but we are a bit stuck because of the lack of the ability to to place two instances of the block.

As far as I've always understood working with blocks since D8, we should always be able to place multiple instances and the it is usual for the block-provider to ensure that each has a unique ID so I thought it sensible to change this to a bug report instead of a support request.

Thank you all.

💬 Support request
Status

Closed: works as designed

Version

2.1

Component

Miscellaneous

Created by

🇬🇧United Kingdom SirClickALot Somerset

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024