Using TOC API for a new module (TOC API node) using it, I met some issue with the TOC Type form, not directly related with the module but with the theme used on a project.
Problem
Bootstrap theme, and any subthemes, add custom variables into the template settings (icon, icon_only, etc). And because the theme implementation do not match anymore the conditions in the TocTypeForm, the select list of templates is empty.
i.e. condition
array_keys($template_settings['variables']) == ['toc', 'attributes'])
is always FALSE
Proposition
Instead of checking if the array $template_settings['variables'] is exactly these two keys toc, attributes, just exclude the toc theme implementations that has the "item" key (and so toc_header and toc_back_to_top).
Another option would be to add a specific key to filter the toc theme implemntations
Patch follow
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | toc_api-add-default-template-type-2887126-6.patch | 3.85 KB | vladimiraus |
| #5 | toc-add-default-template-type-2887126-5.patch | 2.99 KB | smulvih2 |
| #3 | 2887126-2.patch | 763 bytes | flocondetoile |
Comments
Comment #2
flocondetoileComment #3
flocondetoileComment #4
flocondetoileComment #5
smulvih2I had the same issue on one of my projects.
I also think providing a non-responsive theme would be good. On all my projects I end up overriding the responsive theme template file to remove the responsiveness since it's not needed.
Please find attached a patch that adds a new toc_default template. It also adds the toc_type variable to hook_theme() to allow the getTemplates() method to precisely select all defined templates.
Comment #6
vladimirausMinor changes to previous patch.
Availble in patch or dev branch.
Comment #8
vladimiraus