Closed (fixed)
Project:
Footnotes
Version:
6.x-2.x-dev
Component:
Footnotes.module
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
13 Feb 2008 at 10:51 UTC
Updated:
13 Aug 2008 at 20:36 UTC
Jump to comment: Most recent file
Comments
Comment #1
hingo commentedHi chris
If you are using the newest version of Footnotes (and the HTML variant), you should already have this feature. I have chosen not to print the little arrow or any other symbol, but the number of the footnote is a link that leads back to the original place in text. (So the link is at the beginning, not the end.)
The current design decision was based on a philosophy of not adding any icons or text to the text the user writes himself. (The arrow is actually a unicode character. As you see here, it may not even show correctly: http://daringfireball.net/2005/07/footnotes#fn2-2005-07-20)
So I feel that this feature exists and will close this issue. If you want to convince me to specifically use the arrow symbol, go ahead and try to persuade me :-)
Comment #2
Christefano-oldaccount commentedAh, I see now where this feature is. Cool! I didn't see it before because, well... it's been a while since I've installed Footnotes and I didn't see this feature mentioned in the documentation.
This is a great addition to Footnotes. Thanks, and thank you for the really quick reply to this issue.
I'd prefer to have a setting in the input format configuration that would allow changing the placement of the link and giving it a Unicode character. Clicking the number to go back really isn't an immediately obvious thing to do. The good part about having the return arrow at the end of the text is that that's exactly where the reader's eyes will already be after reading the footnote.
If you'd like to reopen this issue, hopefully I or someone else will have the time to contribute a patch that adds a settings form.
Comment #3
hingo commentedWow, if there is potential for an incoming patch...
Status now active again :-)
Comment #4
beginner commentedI've been thinking about this and other output related feature requests.
The thing is, right now all the output html is hardcoded, mainly in _footnotes_replace_callback().
The ideal approach would be to make the output themable, thus the default output can be overridden at the theme level. D6 has a vastly improved theme abstraction layer.
We need to implement hook_theme() and put all the html output in a separate theme function. After that, people will be to customize the output the way they want.
I don't have time to produce a patch, but if christefano of someone produces one, I'll review it.
Comment #5
hingo commentedHi beginner
I completely agree, very good comment. thanks.
Ie: No configuration options, we should use themeability and hook_theme.
Comment #6
emfabric commentedI'm thinking about taking a crack at implementing themability. It seems like there'd need to be two themable output functions, one for a footnote link in the text, the other for the list of footnotes at the end of the text.
Two ways come to mind for specifying the link output function:
function theme_footnote_link($footnote_text,$footnote_label,$randstr)where the three string variables hold the attributes for the link, orfunction theme_footnote_link($fn)where$fnis either a simple object or an associative array, containing the same attributes as properties or keys.The list output function could then parallel that, taking a form such as
function theme_footnote_list($footnotes)where$footnotesis an array of$fnobjects/arrays.I lean towards implementing both functions with minimal attributes to ease their implementation in overriding themes.
I don't really understand what's going on in the textile filter, or if it would somehow need to relate to themed output.
Comment #7
hingo commentedWhat great news! If we get this done, it would make a great 2.0 release of Footnotes. (I was considering dropping/postponing this, so it's really great if you want to do it!) In fact, apart from this #198050: What package to use in footnotes.info ("Input filters")? Affects grouping in Admin panel. is the only one left I'd be semi-interested in closing before 2.0.
First: I'm considering deprecating the textile filter, no need to focus on that. (Or if not deprecating, but there is nothing to do there anyway.)
Arguments: My reading of http://api.drupal.org/api/function/hook_theme/6 especially
to me it says:
1. We can define anything
2. "Between the lines" it kind of implies separate arguments and basic types (strings, numbers) to be used as arguments, not one compound array. Is this just my interpretation or is it reality? How are theme functions typically done in modules? How does it help overriding themes if it is an array? (Ah, I see it now, if things are added to an associative array, you can still use old themes and new stuff would just be ignored.)
You are right that the second function is an array in any case, since it is a list of indefinite length. In that sense using an array also in the first case might be straightforward, since you can then re-use the arrays directly.
I guess I have no strong opinion either way, just these insights. Feel free to just go ahead.
Comment #8
hingo commentedWhen committing your other patch I realised we need to clean up the api here. The using of $randstr as a separate variable is ok as long as it is inside on function, but actually it is an internal thing that theme developers shouldn't need to know about. This just got worse now that I needed to separate $value (the label) and $value_id (safe to use in html id attribute), we simply cannot send all of these to theme functions.
So the interface should rather be
As discussed above, those may be more appropriately passed in an associative array, but this was easier to use in an example.
Comment #9
emfabric commentedOk, here's a go at a patch. It seems to work on my test installation, including overriding the theme functions.
I've defined an associative array that holds the information for a footnote as follows:
These arrays are then used in the two theme functions:
Comment #10
hingo commentedI had a problem that I needed to disable and re-enable the module before it started working. Before doing that all footnotes just disappeared (in other words, the theme functions were not called).
I made a last minute change of mind: I moved back this code:
to footnotes_replace_callback(). It is kind of wrong I guess, since it is up to the theme if it wants to show the text in a title attribute or something else or nothing. So it is unneccessary work that the theme may not use and is redundant with the raw text attribute. Even so I felt it can just as well be done here as a convenience to theme authors. The footnote_link theme is now just a one liner thanks to this.
So the attribute array becomes:
I've committed this to CVS. I'll figure out this one #198050: What package to use in footnotes.info ("Input filters")? Affects grouping in Admin panel. somehow too and in a couple of days I'll make a 2.0 release! Thanks again for this :-)
Comment #11
emfabric commentedI think it also works to clear the cache via "Clear cached data" on the performance page (admin/settings/performance), to get drupal to recognize the presence of themed functions.
I'm not sure how all that effects users upgrading. It shouldn't matter if people are following the recommended procedure of disabling modules prior to installing new versions.
Another thought that I had for maximum themability is to parse the full attribute string on the
<fn>...</fn>and<footnotes />and pass it to the theme functions. For example, this would allow a note of<fn class="highlighted">...</fn>to be passed to the theme function with an extra array element of$fn['attributes']['class']with the "highlighted" value. In the case of the footnotes list, this would require a second argument on thetheme_footnote_listfunction.I don't have a personal need for such functionality, and it would add some additionally complexity.
Comment #12
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.