- π¨π¦Canada joelpittet Vancouver
an
isset($toc['on_off'])
would also work, but this is still good (they made the array_key_exists faster in PHP 8) - π¨π¦Canada joelpittet Vancouver
The notices in #1 I'm seeing when a views page show the body field
Warning: Undefined array key "on_off" in _tableofcontents_apply_toc() (line 155 of /var/www/html/public/sites/all/modules/contrib/tableofcontents/tableofcontents.module). Warning: Trying to access array offset on value of type null in _tableofcontents_apply_toc() (line 155 of /var/www/html/public/sites/all/modules/contrib/tableofcontents/tableofcontents.module).
I found that it was due to 'text_trimmed' because the toc was expanded then truncated.
[toc on_off::hide=0 on_off::automatic=0 on_off::min_limit=5 box::title=On+this+page box::minlevel=2 box::maxlevel=3 box::hide_show=1 box::collapsed=0 header::id_strip::digits=0 header::id_strip::dashes=0 header::id_strip::periods=0 header::id_strip::
Ideally if that is the context, we'd strip out the [toc] and not expand it with settings. I'll try to write a patch for this later.
- π¨π¦Canada joelpittet Vancouver
I made no headway on this except confirming it's a problem. There is indication here of the problem #1891420: panel page wrong markup β in toc_filter
The gist is that we have the context of it being "text_trimmed" but it's too late and it's already been trimmed. One solution could be to get the original value, strip out the
[toc...]
knowing the "text_trimmed" context, and re-run the filters (and avoid the infinite loop) but that seems super wasteful...