Warning message

  • The subscription service is currently unavailable. Please try again later.
  • The subscription service is currently unavailable. Please try again later.

d7tip

Posted by: 
Dominique De Cooman

Use cron queues to store stuff that needs processing later on cron. This post provides a cron queue system to handle jobs in the background.

Posted by: 
Dominique De Cooman

I ll explain how to change the autocomplete callback on an event.

Posted by: 
Dominique De Cooman

This post will give you a list what to check when you go live with a drupal 7 website and how you can control it and automate it. You need to check this go live checklist each time you keep integrating new stuff during deployment to test if everything is still working. To save time this task can be automated.

Posted by: 
Dominique De Cooman

We wanted to add a functionality to our file widget so it could register when to exclude a file from search results.

Posted by: 
Dominique De Cooman

In drupal 7 we have something called contextual links. It is that little wheel you see when you hover over blocks so you can edit them in place. It is a great usability improvement but it is not always that clear how to implement them.

The contextual links functionality used to be a contrib module in d6 now it is a core module.

Posted by: 
Dominique De Cooman

A handy new feature in drupal 7 are the local tasks. We will quickly explain two ways of adding them. Everybody should be
familiar with the two examples to be found in the node module. First example is the add content type on ''admin/structure/types".

First method to create a local task, we can use a hook_menu()

<?php
/**
 * Implements hook_menu().
 */
function node_menu() {

  
//...?>

Posted by: 
Dominique De Cooman

In drupal 7 the recommended method to render output is by using the render api. So no more calling theme(...) directly. Here is a simple example based on the example from the examples module.

<?php

function render_something() {
  
$render_array = array(
    
'child' => array(
      
t('This is some text that should be put together'),
      
t('This is some more text that we need'),
    ),
?>

Posted by: 
Dominique De Cooman

When you query your entities on values on a field, for example you want to get all nodes via a node reference field. In our case we have an event and we want to know all referenced sessions to it.

Posted by: 
Dominique De Cooman

If you want to render only one field of your entities you can in drupal 7. Here in the example we have an entity called model which contains an image field.

To render the field you have to specify to the field_attach_view function which entity type, the entity and the view mode you want to use. The function returns a renderable array.

Posted by: 
Dominique De Cooman

If you want to save only a specific field on your entity instead of saving the whole entity you can. In a submodule of the fields module you ll find a module called field_sql_storage module. In that module all functions available for the sql storage backend can be used. One of them is field_sql_storage_field_storage_write, which you give your entity, type, operator (update, insert) and which fields to save.

Pages

Subscribe to d7tip