function node_gallery_api_entity_update in Node Gallery 7
Implements hook_entity_update().
1 call to node_gallery_api_entity_update()
- node_gallery_api_entity_insert in ./
node_gallery_api.module - Implements hook_entity_insert().
File
- ./
node_gallery_api.module, line 654 - Node Gallery module.
Code
function node_gallery_api_entity_update($entity, $type) {
if ($type == 'node_gallery_relationship_type') {
if ($entity->filefield_name == 'node_gallery_create') {
$entity->filefield_name = NODE_GALLERY_MEDIA_FIELD;
}
$fieldname = node_gallery_api_get_item_field_name(NULL, NULL, $entity->id);
foreach ($entity->settings['relationship_type']['item_types'] as $item_type) {
// Create the gallery reference field.
$ng_field = node_gallery_api_field_information($fieldname);
node_gallery_api_create_field($fieldname, 'node', $item_type);
// Create a media field if selected.
if ($entity->filefield_name != 'node_gallery_none') {
node_gallery_api_create_field($entity->filefield_name, 'node', $item_type);
}
}
}
}