taxonomy_field_insert

Versions
7
taxonomy_field_insert($obj_type, $object, $field, $instance, $langcode, &$items)

Implements hook_field_insert().

Related topics

Code

modules/taxonomy/taxonomy.module, line 1411

<?php
function taxonomy_field_insert($obj_type, $object, $field, $instance, $langcode, &$items) {
  // We maintain a denormalized table of term/node relationships, containing
  // only data for current, published nodes.
  if (variable_get('taxonomy_maintain_index_table', TRUE) && $field['storage']['type'] == 'field_sql_storage' && $obj_type == 'node' && $object->status) {
    $query = db_insert('taxonomy_index')->fields(array('nid', 'tid', 'sticky', 'created', ));
    foreach ($items as $item) {
      $query->values(array(
        'nid' => $object->nid,
        'tid' => $item['tid'],
        'sticky' => $object->sticky,
        'created' => $object->created,
      ));
    }
    $query->execute();
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.