dijit startup()

Here is something that I keep forgetting all the time.
Lifecycle methodstartup()is called for widgets in template, but not for your programmatically created widgets. So for them, you have to call it manually after creating the widget.

Author: (8)


Redirect to the referring page after login in Drupal

Redirection might become a little problematic if you are not sure how to do it in Drupal. You can add at the end of your link ?destination=redirect/here but either the link might not work properly for some reason or you might prefer the referrer page to be dynamic.

Here is the solution:

$destination = drupal_get_destination();
print l('Login', 'user/login', array('query' => $destination));

Source: cglusky

Author: (16)


In Drupal, when you create a select field and you make that field required, you are very likely to run into a weird issue.

The required field will get the first value of the list, making it very easy for the user to overlook it. If the user overlooks it, there is a high probability the first value will not be the correct one. Putting an empty first value does not work as well, as Drupal will just ignore it.

This is actually an easy problem to tackle but the answer might be a little difficult to find. First you should now that you can differentiate the label and the value while configuring the select list. The convention is value|label.

To solve our problem, we are just going to use null value for the first value of the select list. For example |-- Please select --

So a required language list will be something like this. The first value being empty will make Drupal ask for something else if left untouched:

|-- Please select --

PS: You do not have to use labels for other values

Source: grendzy

Author: (16)