function forum_field_storage_pre_insert
forum_field_storage_pre_insert($entity_type, $entity, &$skip_fields)
Implements hook_field_storage_pre_insert().
File
- modules/forum/forum.module, line 527
- Provides discussion forums.
Code
function forum_field_storage_pre_insert($entity_type, $entity, &$skip_fields) { if ($entity_type == 'node' && $entity->status && _forum_node_check_node_type($entity)) { $query = db_insert('forum_index')->fields(array('nid', 'title', 'tid', 'sticky', 'created', 'comment_count', 'last_comment_timestamp')); foreach ($entity->taxonomy_forums as $language) { foreach ($language as $item) { $query->values(array( 'nid' => $entity->nid, 'title' => $entity->title, 'tid' => $item['tid'], 'sticky' => $entity->sticky, 'created' => $entity->created, 'comment_count' => 0, 'last_comment_timestamp' => $entity->created, )); } } $query->execute(); } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!forum!forum.module/function/forum_field_storage_pre_insert/7.x