updated CER from 7.x-2.x-dev (2013-mai-01) to 7.x-2.x-dev (2014-aoû-08)
This commit is contained in:
@@ -191,7 +191,7 @@ function cer_preset_delete($key) {
|
||||
* The operation being performed on the entity (insert, update, or delete).
|
||||
*
|
||||
* @param object $entity
|
||||
* The entity.
|
||||
* The entity or the entity's id.
|
||||
*
|
||||
* @param string $entity_type
|
||||
* The entity type.
|
||||
@@ -201,6 +201,11 @@ function cer_preset_delete($key) {
|
||||
* during bulk update) or NULL if we're not in a batch job.
|
||||
*/
|
||||
function cer_processing_entity($op, $entity, $entity_type, &$context = NULL) {
|
||||
// Load the entity if we're given an ID rather than an entity.
|
||||
if (!is_object($entity)) {
|
||||
$entity = entity_load($entity_type, array($entity));
|
||||
$entity = reset($entity);
|
||||
}
|
||||
// If the entity is of the wrong type, entity_extract_IDs() will throw
|
||||
// EntityMalformedException and rightfully bail out here.
|
||||
list (, , $bundle) = entity_extract_IDs($entity_type, $entity);
|
||||
@@ -291,10 +296,23 @@ function cer_ctools_plugin_api($owner, $api) {
|
||||
function _cer_update($entity_type, $entity) {
|
||||
$entity->original = isset($entity->original) ? $entity->original : NULL;
|
||||
|
||||
$extract_ids = entity_extract_IDs($entity_type, $entity);
|
||||
$id = array_shift($extract_ids);
|
||||
|
||||
field_attach_presave($entity_type, $entity);
|
||||
field_attach_update($entity_type, $entity);
|
||||
|
||||
$extract_ids = entity_extract_IDs($entity_type, $entity);
|
||||
$id = array_shift($extract_ids);
|
||||
// Issue #2212499.
|
||||
if ($entity_type == 'node') {
|
||||
$entity->changed = time();
|
||||
|
||||
db_update('node')
|
||||
->fields(array(
|
||||
'changed' => $entity->changed,
|
||||
))
|
||||
->condition('nid', $id)
|
||||
->execute();
|
||||
}
|
||||
|
||||
entity_get_controller($entity_type)->resetCache(array($id));
|
||||
}
|
||||
|
Reference in New Issue
Block a user