diff --git a/README.md b/README.md index 4654fd3b35e8dda25ff9245ddf2dbf6fb610aea7..54942f68074a7d16e3b1574683769f1ac634463c 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ website. Notes ----- -- The TOC API is based on Drupal 8's OO architecture and patterns while the +- The TOC API is based on Drupal's OO architecture and patterns while the supported feature set is based on the [Table of contents](https://www.drupal.org/project/tableofcontents) module. @@ -137,7 +137,6 @@ References ---------- - [Comparison of Table of Contents / TOC modules](https://www.drupal.org/node/2278811) -- [TOC for D7 (and D8)](https://www.drupal.org/node/1424896) Author/Maintainer diff --git a/composer.json b/composer.json index 4c1a213e36725adae52d17e9f224a590c8f55087..0228f9b429daceb9f5f91e99a68521beee33fbc0 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,8 @@ "name": "drupal/toc_api", "description": "API for building a a hierarchical table of contents from header tags.", "type": "drupal-module", - "license": "GPL-2.0+", + "keywords": ["Drupal"], + "license": "GPL-2.0-or-later", "minimum-stability": "dev", "homepage": "https://drupal.org/project/toc_api", "authors": [ diff --git a/js/toc_type.js b/js/toc_type.js index a1d505051c93833073b07efe3780975386a7358b..0ff1e0b5201ed5b5a93ea30bf62a7cdc114737e8 100644 --- a/js/toc_type.js +++ b/js/toc_type.js @@ -3,13 +3,13 @@ * TOC type options behavior. */ -(function ($, Drupal) { +(function ($, Drupal, once) { "use strict"; Drupal.behaviors.tocTypeOptions = { attach: function (context) { - $('.js-toc-type-options-header-min, .js-toc-type-options-header-max', context).once().change(toggleHeaders); + $(once('.js-toc-type-options-header-min, .js-toc-type-options-header-max', context)).change(toggleHeaders); } }; toggleHeaders(); @@ -25,4 +25,4 @@ } } -})(jQuery, Drupal); +})(jQuery, Drupal, once); diff --git a/modules/toc_api_example/toc_api_example.info.yml b/modules/toc_api_example/toc_api_example.info.yml index 3555d11b3c246238a2c79f6331202437ebfa87b5..00007a77166b30b597e23421ef11486af2a18022 100644 --- a/modules/toc_api_example/toc_api_example.info.yml +++ b/modules/toc_api_example/toc_api_example.info.yml @@ -2,6 +2,6 @@ name: 'TOC API example' type: module description: 'Example of a custom implementation of the TOC API that adds a table of contents to specified content types.' package: 'Example modules' -core_version_requirement: ^8.9 || ^9 +core_version_requirement: ^9.4 || ^10.0 dependencies: - toc_api:toc_api diff --git a/tests/src/Unit/TocFormatterTest.php b/tests/src/Unit/TocFormatterTest.php index e80fccbbb6990fe118f6d40b447cde544fef7fd0..2731c66526b4cffbf88de45245513602dd73aed9 100755 --- a/tests/src/Unit/TocFormatterTest.php +++ b/tests/src/Unit/TocFormatterTest.php @@ -29,7 +29,7 @@ class TocFormatterTest extends UnitTestCase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->formatter = new TocFormatter(); diff --git a/tests/src/Unit/TocTest.php b/tests/src/Unit/TocTest.php index 71d6f03029d669a471d9d7fd231f24276791c1d2..4b7f024b637e99cfc4f73c46720a48c57ff818f5 100755 --- a/tests/src/Unit/TocTest.php +++ b/tests/src/Unit/TocTest.php @@ -32,7 +32,7 @@ class TocTest extends UnitTestCase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->container = new ContainerBuilder(); @@ -433,10 +433,10 @@ class TocTest extends UnitTestCase { // Check update content ids. $toc = new Toc('<h2>header 2</h2><h3 id="three" class="custom">header 3</h3><h4 id="four">header 4</h4><h4 id="four">header 4</h4><h2>header 2</h2>', []); $content = $toc->getContent(); - $this->assertContains('<h2 id="header-2">', $content); - $this->assertContains('<h3 id="three" class="custom">', $content); - $this->assertContains('<h4 id="four">', $content); - $this->assertContains('<h4 id="four-01">', $content); + $this->assertStringContainsString('<h2 id="header-2">', $content); + $this->assertStringContainsString('<h3 id="three" class="custom">', $content); + $this->assertStringContainsString('<h4 id="four">', $content); + $this->assertStringContainsString('<h4 id="four-01">', $content); } /** diff --git a/toc_api.info.yml b/toc_api.info.yml index c6dfd68594d38eff5bcad58d49edb09f4f1ebd17..31ce058b00005768baab96aaeaabc22f77d85b3a 100644 --- a/toc_api.info.yml +++ b/toc_api.info.yml @@ -2,5 +2,5 @@ name: 'TOC API' type: module description: 'API for building a a hierarchical table of contents from header tags.' package: 'API' -core_version_requirement: ^8.9 || ^9 +core_version_requirement: ^9.4 || ^10.0 configure: entity.toc_type.collection diff --git a/toc_api.libraries.yml b/toc_api.libraries.yml index 2eed12a2c1f415ff490e4a760804cd56c04f3512..2bb5c9ee3d93015a1f7c98f571d2f74e819a9eb9 100755 --- a/toc_api.libraries.yml +++ b/toc_api.libraries.yml @@ -4,7 +4,7 @@ toc_type: js/toc_type.js: {} dependencies: - core/jquery - - core/jquery.once + - core/once toc: version: VERSION @@ -32,7 +32,7 @@ toc.menu: - core/jquery - core/drupal - core/drupalSettings - - core/jquery.once + - core/once toc.responsive: version: VERSION