Révision 950416da
Ajouté par Assos Assos il y a plus de 5 ans
drupal7/sites/all/modules/field_collection/field_collection.install | ||
---|---|---|
124 | 124 |
->expression('revision_id', 'item_id') |
125 | 125 |
->execute(); |
126 | 126 |
|
127 |
// Add the archived column |
|
127 |
// Add the archived column.
|
|
128 | 128 |
$archived_spec = array( |
129 | 129 |
'description' => 'Boolean indicating whether the field collection item is archived.', |
130 | 130 |
'type' => 'int', |
... | ... | |
365 | 365 |
if ($field['translatable'] == 1 && isset($field['bundles']['field_collection_item'])) { |
366 | 366 |
$query = new EntityFieldQuery(); |
367 | 367 |
$query->entityCondition('entity_type', 'field_collection_item') |
368 |
->fieldLanguageCondition($f_name, LANGUAGE_NONE);
|
|
368 |
->fieldLanguageCondition($f_name, LANGUAGE_NONE); |
|
369 | 369 |
$query_result = $query->execute(); |
370 | 370 |
if (isset($query_result['field_collection_item'])) { |
371 | 371 |
$results = $results + $query_result['field_collection_item']; |
... | ... | |
373 | 373 |
} |
374 | 374 |
} |
375 | 375 |
if (count($results)) { |
376 |
$orphans = array(); |
|
376 | 377 |
$ids = array_keys($results); |
377 | 378 |
$field_collection_items = entity_load('field_collection_item', $ids); |
378 | 379 |
foreach ($field_collection_items as $item) { |
379 |
$item->copyTranslations(LANGUAGE_NONE); |
|
380 |
$item->save(); |
|
380 |
/** @var FieldCollectionItemEntity $item */ |
|
381 |
if ($item->hostEntity()) { |
|
382 |
$item->copyTranslations(LANGUAGE_NONE); |
|
383 |
$item->save(TRUE); |
|
384 |
} |
|
385 |
else { |
|
386 |
$orphans[] = $item->identifier(); |
|
387 |
} |
|
388 |
} |
|
389 |
if ($orphans) { |
|
390 |
$count = count($orphans); |
|
391 |
entity_delete_multiple('field_collection_item', $orphans); |
|
392 |
drupal_set_message("Deleted $count orphaned field collection items."); |
|
381 | 393 |
} |
382 | 394 |
} |
383 | 395 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules