1. Installed the module for drupal core 8.9.11. Module installed successfully.
  2. Enabled it for a field and the "h2" tag. This step was successful.
  3. The block doesn't appear in the block list. Tried clearing cache etc.
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

achandel created an issue. See original summary.

achandel’s picture

Issue summary: View changes
achandel’s picture

Issue summary: View changes
e0ipso’s picture

Please, let me know if you find a fix or realize why it was not working.

cfbauer’s picture

I can confirm it works on 8.9.10 at least, but I noticed it doesn't wok on paragraphs if that's what you're doing.

shriaas’s picture

So I just tried to add label in the annotation in Plugin\BlockTextLongFieldTocBlock class, some thing like this:

@Block(
 *   id = "text_long_field_toc_block",
 *   deriver = "\Drupal\table_of_contents\Plugin\Derivative\TextLongFieldTocBlockDeriver",
 *   context = {
 *     "language" = @ContextDefinition("language", label = @Translation("Language"))
 *   },
 *  label = "TOC Block"
 * )

And now I am able to see the block on block administration page XD
The label got overridden getPreviewFallbackString() but I guess we need to have some default value first to later override it using getPreviewFallbackString()

e0ipso’s picture

Great finding! Any chance you can submit a merge request or a patch for this?

shriaas’s picture

Status: Active » Needs review

Done @e0ipso! Added solution suggested in #6

jjancel’s picture

with drupal 9.3.6 the TOC block no longer appears
Solution suggested in #6 does not work
the use is no longer the same as that described
is this project still valid ?

e0ipso’s picture

I want to make sure everyone is using 2.x and not 8.x-1.x as stated in the issue metadata.

e0ipso’s picture

Can someone verify if this is an issue in 2.x?

vlyalko’s picture

Installed 2.x and no configuration option appearing in CT display

Christopher Riley’s picture

Version 2.x doesn't show on D9.4 even after downgrading symfony/css-selector to version 4

mlncn’s picture

Version: 8.x-1.1 » 2.x-dev
Status: Needs review » Needs work
megakeegman’s picture

Title: TOC block doesn't appear on Drupal 8.9.11 » TOC block doesn't appear
megakeegman’s picture

Title: TOC block doesn't appear » TOC block doesn't appear in block list

megakeegman’s picture

I'm not entirely sure what happened here. The MR that was opened #6 does work for 2.x, though the MR was opened to 8.x-1.x. So i opened a new one. I tested and this does fix the issue. Of course, in order to get this far I also needed to create a patch for another issue related to the symfony/css-selector versioning. Though that's a different issue.

Extra note: I pushed this extra branch with git push table_of_contents-3188114 3188114-2.x-toc-block-doesnt, but for some reason an extra MR seems to have appeared. I'm not sure what happened there, but definitely worth reviewing to make sure nothing fishy made it into this MR. Thanks!

megakeegman’s picture

Status: Needs work » Needs review
farhanmae’s picture

Issue still there in v2.0.1 on Drupal 9.5.7