Martin Muzatko Posted November 13, 2015 Posted November 13, 2015 Hello there! I'd love to publish my first ProcessWire module. Please let me know if you have any thoughts regarding the quality, documentation or new features you would like to see. See Github page: https://github.com/MartinMuzatko/TextformatterAutoAnchor/ ProcessWire Module: http://modules.processwire.com/modules/textformatter-auto-anchor/ TextformatterAutoAnchor Automatically add anchors and IDs to Headings What is it doing? This Textformatter adds an id attribute to every heading with a slug of the text. Intended for easily creating linkable sections. Demo Currently it is used at http://www.happy-css.com AutoAnchor in action: http://happy-css.com/lessons/riotjs/reusable-components/ Preview can be seen on Github Configurable Variables Heading Selector Determine which headings you want to have the ID + anchor Use a regex-like range or list, e.g.: 2-6 or 346. Anchor Class Your css classes that are attached to the anchor link. Anchor Content The text for your anchor. If you prefer an icon, you could also use HTML for example. What are the Alternatives? There are existing tools like Anchorific JS but its dependency is jQuery. I love to have an alternative that is PHP only. Known issues Anchors are placed in front of the text. This could be a future configurable setting. The slug is also not configurable yet, currently it is lowercased and space is replaced with hyphens/dashes 12
kixe Posted November 24, 2015 Posted November 24, 2015 (edited) The module is tagged compatible with pw 3.0. If so it is recommended to declare a namespace or use pw namespace <?php namespace ProcessWire; More Info: http://processwire.com/api/coding-style-guide/ Please find correction in following post Edited January 8, 2016 by kixe
LostKobrakai Posted November 24, 2015 Posted November 24, 2015 @kixe I think if modules should work under 2.7 and 3.0 without code changes they need to be without namespace. 1
Martin Muzatko Posted November 30, 2015 Author Posted November 30, 2015 I agree with LostKobrakai - it should work without namespace. I'll look to find some time to test it in all versions. Should work fine from as early as v2.0
adrian Posted November 30, 2015 Posted November 30, 2015 @kixe I think if modules should work under 2.7 and 3.0 without code changes they need to be without namespace. I can confirm that adding the ProcessWire namespace to a module and trying to run it on PW 2.x results in an error.
bernhard Posted January 26, 2022 Posted January 26, 2022 I've built a similar module today because I didn't know about this one...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now