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

Comments

flocondetoile created an issue. See original summary.

flocondetoile’s picture

Issue summary: View changes
flocondetoile’s picture

Status: Active » Needs review
StatusFileSize
new763 bytes
flocondetoile’s picture

Issue summary: View changes
smulvih2’s picture

I 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.

vladimiraus’s picture

Minor changes to previous patch.
Availble in patch or dev branch.

  • VladimirAus committed 7ef48d7 on 8.x-1.x authored by smulvih2
    Issue #2887126 by flocondetoile, smulvih2, VladimirAus: template options...
vladimiraus’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.