Problem/Motivation

If there are not TOC types defined on admin/structure/toc, this message will be generated when editing a text format (such as admin/config/content/formats/manage/full_html):

Warning: Undefined variable $types in Drupal\toc_filter\Plugin\Filter\TocFilter->settingsForm() (line 55 of /.../modules/contrib/toc_filter/src/Plugin/Filter/TocFilter.php).

Proposed resolution

Initialize the variable and add an explanatory message when there are no options.

Remaining tasks

Implement.

User interface changes

No warning message. Explanatory message appears.

API changes

None.

Data model changes

None.

Issue fork toc_filter-3584773

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

liam morland created an issue. See original summary.

liam morland’s picture

Status: Active » Needs review
schillerm’s picture

Status: Needs review » Reviewed & tested by the community

Hi, reviewed this change, was able to reproduce the error. Was not able to delete the "default" Table of contents type via the GUI so ended up using drush config:delete toc_api.toc_type.default to do this.

Was able to see the error message described in the issue.

Switching to issue branch and after a drush cr + page refresh the error is gone, I can also see the "No TOC types are defined..." message as expected. The filter seems to work even when there are no Table of contents types.

Code change seems simple and makes sense to me. Moving to RTBC.