Synopsis
This module automatically creates a context specific table of contents (TOC) for long pages based in h2-h6 tags (for any node types selected in module settings). You can choose predefined styles, or use your own. Also there are settings for TOC position, allowed node types, show/hide options for users and much more.
Here is a screenshot: https://www.drupal.org/files/styles/grid-3/public/project-images/super-t...
The project page is currently located at:
https://www.drupal.org/sandbox/dillix/2501087
Git clone command:
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/dillix/2501087.git super_toc
Depencies:
Entity API, Libraries 2, Transliteration
Current release state
The module is fully functional and being actively tested in some of my actual projects.
Similar Modules
Text format filter which converts user entered token into a table of contents. Has a lot of features.
Text format filter which converts user entered token into a table of contents. A lightweight alternative to the Table Of Contents module.
Adds Table Of Contents to a single field as a field formatter option.
Works only as Panels pane
Other modules:
It seems that some of similar modules was abandoned for further development (no new commits & bug fixes for two years and more): Simple TOC, Simple Table of Contents, Node Field TOC, TOC Node
My reviews of other projects
https://www.drupal.org/node/2502333#comment-10003755
https://www.drupal.org/node/2501207#comment-10003679
https://www.drupal.org/node/2502503#comment-10003767
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | Snip20150608_3.png | 457.13 KB | everright |
Comments
Comment #1
PA robot commentedWe are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #2
dillix commentedComment #3
everright commentedHi dillix,
I have test your module and take manual review, module worked, but have some bugs, also some suggestions.
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.
Bugs
1. Clean empty values of checkboxes.
This bug will be happen on front-end, exclude "Heading levels" still display without "Show hierarchy ", also html still here with "Show hierarchy ".
super_toc.module (line 231)
2. Same id of span tag when same title
An article may be have some text is same in "Heading levels", then the id of span and hash tag on link will be same, so goto hashtag will be incorrect when click TOC link.
Suggestions
1. In file super_toc.admin.inc
For super_toc_position, I think you can define Constant variables, then replace (1,2,3,4) with Constant variable, such as SUPER_TOC_POSITION_BEFORE, SUPER_TOC_POSITION_AFTER, SUPER_TOC_POSITION_TOP, SUPER_TOC_POSITION_BOTTOM, also update this on if conditions in file super_toc.module.
Drupal have function to do that, drupal_map_assoc(array(2, 3, 4, 5, 6, 7, 8, 9, 10)).
2. Add validate and set values to NULL if not visible for "#state"
"super_toc_smooth_scroll_offset" will be visible when "super_toc_smooth_scroll" checked, so it is good to add form validate function to check "super_toc_smooth_scroll", if not checked, "super_toc_smooth_scroll_offset" value should be NULL, also for other "#state".
3. Clean empty values of checkboxes
super_toc.module (line 39-41)
Comment #4
everright commentedComment #5
dillix commentedHi everright,
Thanks for review. I fixed all bugs and implemented suggestions that you have found. Can you check my module again?
Comment #6
dillix commentedComment #7
everright commentedHi dillix,
Good job! There were no pareview issues, and all #3 bugs fixed.
But I'm so sorry, found below, please check and test again.
1. I'm try to config Show text to "Show >" and Hide text to "Hide >" in admin settings page, then show worked, but hide trigger not working.
2. You have used Constant variables for super_toc_position, so I think you should update variable_get('super_toc_position', 1) to variable_get('super_toc_position', SUPER_TOC_POSITION_BEFORE) in files (super_toc.module, super_toc.admin.inc).
3. Lines 153-157 of file super_toc.admin.inc
Suggest to use theme('image', $variables) to replace part of img.
Comment #8
dillix commentedHi, everright
I fixed #1, #2 and #3.
Comment #9
everright commentedHi dillix,
Great, I've tested, and all are worked.
I think this module is RTBC? Anyone else?
Comment #10
cfreed commentedHi dillix,
This is a very interesting module: I installed it and it's working as expected, so I'll be glad to set status to RTBC, but there are currently a few points against that. This isn't at tall to say your project is bad, but it souhld conform to the Drupal community's policies.
Here is my review based on the usual review template:
Automated Review
I'd not looked at PAReview since everright said it's ok, but please note that to be consistent your task page should include a link to PAReview results.
Manual Review
This is a point you didn't address in your project page. Could you explain how this module differs notably from those listed in this TOC modules comparison page?
You may look at the "Similar projects and how they are different" paragraph in the Tips for a great project page page.
You should at least populate the "Requirements" section like in your project page.
$entity->content['body']['0']['#markup']: so if thebodyfield has more than one value, only the first one is processed.In some cases, especially for long articles (which is just your module's target usage), a
bodyfield may be split in a number of values, each one standing for a kinda <h1> and afterwards including lowest <h?> parts.So you should at least process any existing
$entity->content['body']['**n**']['#markup']bodyvalues), the configuration form could offer an interesting option to the user:bodyinstancebodyinstancebodyfield is involved: you may encounter nodes where other, user-defined fields are of type long-text too, so it might be consistent to process them as well.The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.
If added, please don't remove the security tag, we keep that for statistics and to show examples of security problems.
This review uses the Project Application Review Template.
Comment #11
dillix commentedComment #12
dillix commentedComment #13
PA robot commentedClosing due to lack of activity. If you are still working on this application, you should fix all known problems and then set the status to "Needs review". (See also the project application workflow).
I'm a robot and this is an automated message from Project Applications Scraper.