Drupal API

Batch API

Drupals internal batch API can be really helpful for handling large cumbersome processes on your web server. Rather than submitting a form and waiting for one of these processes to finish before reaching the next page, the batch API can be utilized to break the process down across multiple page loads. This not only cuts down on the server load, but will prevent the page from timing out. Progress bars will be displayed to the user while the process runs which will keep them informed of where they are at in the process.

Modify Integer field to Decimal

Technologies: 

The purpose is to modify the integer field which captures temperature in decimal.

A good way is to execute a hook_update_N() API in custom module which allows incremental updates when installing, or visiting update.php
WARNING: Does not work. Its better to recreate field after copying data to another temp field.
[ http://drupal.stackexchange.com/questions/103157/modifying-integer-field... ]

Allow HTML markup in quicktabs

Technologies: 

Quicktabs by default strips html tags in Quicktab title by default. To add additional markup of text changes, hook_quicktabs_alter() is not sufficient the quicktabs tabset needs to be overriden to allow html markup in titles.

hook_quicktabs_alter() to modify title. In the example modification for the first tab is done

Change the text of Apply Button on views Exposed form

The following snippet changes the views exposed form Apply Button to Search Jobs. Make the changes in template.php file of the currently enabled default theme. Clear cache to see it work.(Clear class registry cache to be precise.)

<?php

function YOUR_THEME_NAME_preprocess_views_exposed_form(&$vars, $hook){
// only alter the required form based on id
// drupal_set_message(t("form id: ".$vars['form']['#id']), 'status', FALSE);
if ($vars['form']['#id'] == 'views-exposed-form-search-openings-page') {
// Change the text on the submit button

Using Entity Metadata Wrapper

The Entity API provides wrapper classes you may use to make dealing with the values of an entities properties and fields easier. Wrappers make it easier to get and set the values of fields and properties as well as to programmatically retrieve additional information about these elements and iterate over lists of values in a consistent manner.

This implies that one need not worry about fetching a node property in the format:
$node->field_name['und'][0]['value']  

Using State API in Drupal Forms (Custom Conditional Fields)

The following is a snippet on how to enable fields to appear and/or disappear based on the state of other fields.

<?php

/**
* Modifications for including State API functionalities. The idea is to hide the fields field_referme_industry
* and field_referme_major_skills, based on the value of another field.
* The functionality can be implemented during the after_build phase
*/
function jc_form_alter(&$form, &$form_state, $form_id) {
//drupal_set_message("Form Id is: $form_id ");
if($form_id == 'referme_node_form') {