Attaching Extra or Pseudo Fields to any Entity in Drupal

This thing is so cool and only recently I found about it. You can create pseudo fields with your entites, most often content types. So you can make some add, edit, delete buttons or any kind of forms on your entites or nodes. And it is pretty quick and straight fwd solution.

Update and insert only specific fields of your entity

TO not need to use hook_entity_presave and save whole entity try this

//Get the id of your field
$field_name = 'name_of_your_field';
$info = field_info_field($field_name);
$fields = array($info['id']);

//Execute the storage function
field_sql_storage_field_storage_write($entity_type, $entity, 'update', $fields);

Enable errors and logging with drush or with settings.php

You have error, your site is not accessable and you need to see what is the problem but logging and errors are set to none.
Type this with drush

drush vset error_level x

Where x is 0/1/2, depending on what you want

0: none
1: errors and warnings
2: all

You can also do the same with settings.php, adding to it this

Drupal commerce checkout redirect pause

When using different payment methods for checkout, sometimes you will have a payment gateway that will redirect you to different page, like paypal. But what if you want to have your frontender a chance to look at a page before redirect to style it?

Page to change only password and email

We needed to have a custom page or a block to only change email and password on that page, and the other user info we separated in different page. Sounds like a nice solution for users. So what we did is the following.

-custom menu item
-custom form
-validation and submit

Cancel button on drupal forms

This one is short but sweet. Usually drupal forms don't have cancel buttons that bring you back to previous page, so lets add one.