Closed (fixed)
Project:
htmLawed
Version:
6.x-2.10
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
17 Mar 2011 at 09:53 UTC
Updated:
30 May 2011 at 06:49 UTC
Jump to comment: Most recent file
Implement the following:
See #987946: disappearing image for more details.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 1095752-htmLawed_one_config-1-D6.patch | 54.41 KB | andyf |
Comments
Comment #1
andyf commentedHere's how I would personally modify the module. I haven't included anything about upgrading yet: I'm not sure what the best approach would be. Here's one idea.
htmLawed_format_x) aren't automatically deleted.What do you think?
Comment #2
andyf commentedComment #3
alpha2zee commentedAndyF, thank you for suggesting this patch. I haven't had the time to test it as yet, but I will do so soon. I will like to point out two things though.
Regarding one htmLawed setting per input format:
(1) The current htmLawed module has a 'default' setting for 'Config', etc., which is by default used with all content-types. Content-type-specific settings are set by disabling use of the 'default' setting and providing content-type-specific values for 'Config', etc. Thus, one does have an option to have just one htmLawed setting for an input format.
(2) It is possible to use the Better Formats module with htmLawed regardless of whether there is just the 'default' setting in use and no content-type-specific setting, or there are content-type-specific settings in effect.
Regarding the 'Body' vs. 'Other' issue, which is separate from one htmLawed setting per input format, the problem still remains. For the time-being I suggest using the same setting for both 'Body' and 'Other' by identically filling the form-fields for htmLawed configuration.
Comment #4
andyf commentedHi alpha2zee, thanks for the reply.
For me these are two sides to one problem. There's a particular way that Drupal's input format architecture works. At the most basic level there are filters, like this one. As I see it, a filter can be viewed as a function: it takes an input and delivers an output. Where possible (and certainly with a filter like htmLawed which might eat resources) you want to always have the same output for the same input (which makes things simpler at higher levels, and allows you to cache). It follows from that idea, that you really only want to have one set of config options (this means not having multiple content types or body-, teaser-specific settings, etc.). It really should be (imho) one set of config options per filter, period.
So what's the Drupal way of doing content type specific settings? Using input formats. This way you can create a completely customised input format for one situation, and an utterly different one for a different situation. As htmLawed stands, it works at the filter level, but offers functionality that lives at the input format level. What do I do if I want to have htmLawed and filter x to run for content type story, but htmLawed and filter y to run for content type page? I can't (not using htmLawed's content type functionality). As well as this, it's easier for a module running at a higher level to understand the context and make a correct decision about whether this textarea represents the body, a block, etc. (In fact, this was the initial problem that brought me to the issue queue - the filter was trying to decide if it should be in body or other mode, and made the wrong decision because it just doesn't have sufficient information, as it's really supposed to be a pure function.)
If you do use htmLawed with better_formats to solve the problem I describe above then you're duplicating functionality, and you have lots of settings hanging around to confuse the user (ok so although it says on this filter that it will use these settings for this content type, better formats is actually going to select an entirely different input format that has different settings). It's a recipe for confusion imho.
Also, caching can lead to unpredictable results (because the same filter yielded different results despite having same input, due to some change in context); not caching obviously has performance implications, and would certainly be a deal-breaker for me personally.
It also means that as other modules are released for interacting with input formats, there's a good chance they won't play nicely with it.
Basically, as I see it, all the functionality offered by this module is great - but it should not live in a filter. If you cut down this filter to something like my patch and use better formats you have a cleaner, less confusing, and more performant solution. I think the only thing that better formats can't do is change input format for teaser/body and for other. Maybe there's already a contrib module that does it; if not, then you can write the functionality as a separate module that isn't a filter.
Thanks for your time,
Andy
Comment #5
alpha2zee commentedI agree with your suggestion that the htmLawed module should adhere to the Drupal philosophy. The module's core function is to provide a filter. Additional functionalities that it provides are: (1) content-type-specific settings, (2) body/teaser/other-specific settings, and (3) having Drupal save filtered anand not raw content. I am not very sure that (1) and (2) deviate the module from the Drupal philosophy. Drupal 7 core takes care of (1). For Drupal 5/6 there is the Better Formats module. So it makes sense to remove (1) from htmLawed module. I don't know of a Drupal core functionality or any module for (2), but clearly there are code-logic issues which make is difficult (impossible?) to deliver (2) in a fool-proof way. So, I will go ahead and work towards releasing version 3 of the module that will not have (1) or (2).
Comment #6
andyf commentedI've just taken a quickish look, and can't find any module for (2). Maybe it would be worth seeing if the author of better_formats would accept a patch to add the functionality there?
I didn't know that, that's cool!
It still seems to me that this shouldn't live in the filter. If I want to save filtered content to the database, then it would be nicer to save the output of the whole input format (not just the individual filter). And it ought to be independent of htmLawed: maybe for one content type I don't want to use htmLawed but I still want to save the filtered output to the database.
Btw, imho saving the filtered content to the db is quite a big change to the default Drupal input format system, so I think it needs lots of clear warnings!
Just my 2 cents
Comment #7
alpha2zee commented> Drupal 7 core takes care of (1)
See http://drupal.org/node/1003262
> (3) having Drupal save filtered and not raw content ... needs lots of clear warnings!
No need to get alarmed. This is an option and not default, and the module has good documentation. For lot of Drupal administrators, HTML filtering is all that is needed, and htmLawed can be the only filter used. Saving filtered content is a handy option for those who want to use it. I will keep it in the next release.
Comment #8
andyf commentedHi alpha2zee
I'll stop nagging you after this, but thought I might give it one last go! If I helped create a separate module that handled saving filtered content to the database, would you be ok separating that functionality from the htmLawed filter?
Thanks for your time.
Comment #9
alpha2zee commentedAndyF, I actually appreciate your 'nagging' :) Perhaps there already is a module for that #3 functionality. Let me check.
Comment #10
andyf commentedThanks alpha2zee!
Comment #11
alpha2zee commentedVersion 3 of the module for Drupal 6 (and 7) has been released. Thank you AndyF for encouraging me to release a new version of the module. Thanks too for the patch you provided.
Comment #12
andyf commentedThanks for all the hard work you've put in alpha2zee!
Comment #13
NPC commentedHm, this is an odd decision, I used this module specifically to filter teasers differently from the body (so that body can have all kinds of formatting, while the teasers are shown consistently). If anyone finds a replacement module for this - could you please post it here, for completeness of the discussion?
Thanks!
Comment #14
alpha2zee commentedNPC, alongside the new version 3 of the module, version 2 of the module will be maintained for Drupal 6 and it will continue to have the old set of features.
Comment #15
NPC commentedThanks for maintaining it, alpha2zee.