Wanted to share with you all a cool thing I got for Christmas from my cool wife :) A handmade Druplicon!

Handmade Druplicon

I guess I'm spending too much time with Drupal if even my wife knows how Druplicon looks like ;)

I want to wish Merry Christmas to all Drupal people all over the world!

santa-drupal.jpg

Get away of your computers, nodes, views and entities. Type exit in your terminal and spend some time with your family :) They deserved it.

Time from time you need to update single or several specific fields of your entity in Drupal. It can be node, comment, taxonomy or some other custom entity. So how do we usually do this? Let's see:

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.

Pages

Subscribe to TimOnWeb RSS