Error message

User warning: The following module is missing from the file system: expose_table. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1143 of /home/deb116182/domains/

This page is mainly my notebook of usefull snippets of code. Whenever I come across something usefull or come up with something usefull I will post it here.
To be able to reuse it later and to share.


Theming $fields output of views

When you want to theme the fields output of a view here is what you need to do:

 print $fields['my_field_name']->content; 

That was the short answer. Now you are maybe wondering where you would  put that line of code?
In the views configuration go to advanced>theme>information. Here you see a summary of all the templates views has allready and the naming conventions of possible custom templates.
Pick one from the fields examples and make a new tpl file with that name.

Rendering fields in Drupal 7

The short answer:

use field_view_field();

The long answer:

In drupal 6 it was perfectly common to poke around in the node object to get your values and print them.
With the field api and entities in drupal 7 however we need to change that habit and use the functions drupal provides us.
Luckily field_view_field() comes in here. 

$output = field_view_field('node', $node, 'field_name');

Combine it with

The Calendar module for Drupal

The other day I needed a calendar for one of my projects. There are basicly 2 choices to pick from on There is the Full Calendar module, but this one isnt actively maintained. So if you feel like you have spare time and want to contribute to the drupal community you could go ahead and help maintain that module.
The other choice we have is Calendar. This module is still actively maintained and a lot of sites have reported using this module. So I picked this one too.

Custom validations on user profile form

Sometimes you want to have some more fields on your user profile form. This is quite easy to setup. However Drupal will not validate these fields out of the box.
So we need to write our own validation functions and tell Drupal that it exists.

Here is a simple example:
function example_user_profile_form_alter($form_id, &$form, &$form_state){
  if($form_id == 'user_profile_form'){
   $form['#validate'] = 'example_user_profile_custom_validate';