Ok, you're clever guy/girl and don't use some generic modules like computed field, right? And you want to change some node field data based on your conditions, right? What will you do? Of course, write your manipulation using hook_node_presave(), but there are some circumstances, when this hook won't work (for example, you need a node id for a "to be created" node, which isn't available in hook_node_presave()) and you will have to deal with hook_node_insert() and hook_node_update(), so what will you do then?

Drupal 7 (and, obviously Drupal 8) breathe by entity. Entities are everywhere and you can't code a site without them. But here is the problem: all entities have ids, but these ids have different names accross Drupal. Just to give you few examples: Entity id in Node is $node->nid, Entity id in User is $user->uid and so on. Inconsistency as you may say. What if you want to write a code which works accross all entities, how to get entity id for every entity type without writing additional code? I'll show you how.

A quick tip: If you don't want to have a "reply" link in your comments, here is a simple way to remove this link.

Being a Drupal developer I do use magnificent redmine (http://redmine.org) to manage my tasks and projects. If you don't know, Redmine is a Rails-based application so from time to time I have my hands dirty with ruby code (it doesn't hurt at all ;)).

Theming in overall (not only in Drupal) can be a very painful process: themer looks at the .psd, then switches to his editor of choice, types some css rules, hits save, switches to a browser, hits refresh button and finally, looks at results. So much moves just to change only one css rule and check if it works! But what if this could be done more quickly, what if you could change css directly in your browser and have these changes automatically saved directly to your css file?

When you need a fashionable ‘carousel’-like module for your Drupal website I bet you will choose jCarousel module (http://drupal.org/project/jcarousel) to fulfill the need. But what if you want to change the default look provided by the module (in 99% of cases, everyone wants this) what will you do? “Tweak a theme css!” - young Drupal geek will say. “No! Make a custom skin for it!” - old Drupal expert will answer.

It's almost midnight in my area, but I couldn't resist sharing this cool theming tip with you. Ok, so you want to create a cool collapsible div to hide some content on your page. What would you do? Write another javascript/jquery snippet and mess with callbacks, toggles, etc?

Well, in Drupal this can be done even easier! Chaos tool suite (aka Ctools) comes to rescue! This module is a must have on any website, so don't worry about installing one more module to do a simple thing. And I'm 90% of you have it already installed.

Time from time, while developing websites with Drupal I encounter the problem of debugging email messages my site sends.

The common solution is to send test messages to your own mailbox to see how messages look like, debugging them this way. But this is not the most comfortable solution, moreover, it can become a nightmare debugging email on a localhost, especially on Windows, when you have to install local mail server, route all the stuff to localhost mailboxes and hassle with Mercury or some other thing...well in overall, it is not the most pleasant thing to do.

People are lazy by nature and love when something is done for them automatically. As web developers, we can always use this need in our website designs by creating different autocomplete fields to ease website visitor's experience. Being the best CMS platform outhere, Drupal allows us to create autocomplete fields within a blink of an eye. Here’s how to do this:

The task is very common, but in Drupal 7 you do this in a bit different way than in Drupal 6. Here’s how to remove format options from comments textarea in Drupal 7:

UPD: Well, the most easiest way to do this is to install Better Formats module (http://drupal.org/project/better_formats). But do we need another module installed to do this simple thing? Me, not, so let's dig into the code a bit.

Basically, we need to alter comment form. You can do this in two ways:


Subscribe to TimOnWeb RSS