fields

Saving node's fields without saving the node itself

Saving node's fields without saving the node itself.

http://blog.urbaninsight.com/2011/10/24/saving-nodes-fields-without-savi...

Node add only fields

Saving node fields without saving the node itself.
http://blog.urbaninsight.com/2011/10/24/saving-nodes-fields-without-savi...

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

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.

Posted by: 
Dominique De Cooman

This small drupal 7 tip will help you get out values from entity objects, like nodes, users, taxonomy, ...

You probably seen this data structure when loading nodes:

<?php
$entity 
->fieldname[language][delta] = [item];
?>

Think twice when defining a new content type

Think twice when defining a new content type

http://drupal.org/project/conditional_fields

This project allows you to have conditional fields.
Example : we have a content type bus and tram with only two fields difference. The type gearbox for a bus and the type of controller for a tram. All the 10 other fields are just the same. You dont want a new content type for that. You need a conditional field.
So create content type vehicle and have vehicle type field, now set the other fields like gearbox - controller conditional to this one. I also works with fieldsets.

Posted by: 
Dominique De Cooman

A cck fieldgroup can be rendered alone. We had some quicktabs we wanted to fill with our field groups. So we've builded a block for each field group to put in the quicktabs. Here is an example of one block where we called a single fieldgroup and rendered it.

Posted by: 
Dominique De Cooman

How to add another formatter to a cck field? A cck formatter is basically a theming function where the value of field is ran through. Formatters are available at "admin/content/node-type/[your node type]/display" in the cck interface.

Pages

Subscribe to fields