Drupal

Disable login field memory

Here's a tweak that makes the login form a little more secure. It attempts to disable the auto-complete features of browsers to remember the values of the username and password fields.

Condensing Forms with Help Icons

A project I'm currently working to clean up a bit has some lengthy forms in it. They're already broken up a bit with CCK Fieldgroup Tabs, but I wanted to trim them down a bit further.

By theming the form elements, we can take the description of a field and use it as the title attribute of a small help icon image attached to the field. Then the user can hover over that to see the description, but it takes up much less vertical screen real estate.

Domain Access redux

I'm working to convert a fairly complex site from Drupal 5 to Drupal 6 (just in time for Drupal 7). It uses Domain Access extensively, so that had to stay. I also wanted to increase performance a lot as part of the move, so I decided to try out Boost, since the vast majority of the visitors are anonymous.

Insert module and breaker filter

I ran across the handy-dandy Insert Module yesterday, which, in its own words, "adds a simple JavaScript-based button to FileField and ImageField widgets [so that] images may be inserted into text areas with a specific ImageCache preset".

It works just fine without a wysiwyg, too. If there are imagecache presets being used, it inserts the preset name as a CSS class. That let me create, for example, two presets that differ only in name, and style them to float one left and the other right, allowing the user to easily insert stylish images into a node. Most rad.

My only problem was that I there were a lot of images and not a lot of text, so the floats were bumping into each other and causing all kinds of text-warping oddities.

My solution is a new input filter that places a float-breaking entity before each inserted image. I thought about inserting it along with the image, but that would clutter the body editing field. jQuery would have been really easy, but comes with all the classic js drawbacks.

Rendering External URL Aliases as External Links

Drupal 6 doesn't seem to mind if you save an external URL as a node's path alias. Rendering it, however, throws the full, escaped URL as a path within the site. For some reason (I'm guessing .htaccess), those links still end up going to the external URL, but they look most ugly, and don't trigger External Links processing.

So, the key is the custom_url_rewrite_outbound function. This weird, quasi-hook of a function can be placed in settings.php to affect the behavior of links generated by url(). As noted in that documentation, url() may be called dozens of times in a single page request, so performance is extremely crucial here.

Syndicate content