Field api - sinsunsan/archiref_wiki GitHub Wiki

Ressources

  • The field api is the major inovation of drupal 7, and allow modules like organic group that once have custom tables tio use the same api than other modules.
    http://drupal.org/node/707832 Field API tutorial

  • Tuto to learn field api with the help of a color picker module http://www.figover.com/node/15

Drupal 6 only

Attach fields to display them

Exemple of the use of this 3 functions in https://gist.github.com/40e049c86061a114cfde

edit a field value
http://api.drupal.org/api/drupal/modules!field!field.crud.inc

$position = field_get_items('taxonomy_term', $term, 'field_term_position');
$taxonomy_major = field_get_items('node', $node, 'field_taxonomy_main', $node->language);

Autres solutions un peu moins simple

$lang = field_language('node', $node, 'field_taxonomy_main');
$term_major = $node->field_taxonomy_main[$lang][0]['tid'];