fixed the create materials bugs from materio_id module
This commit is contained in:
@@ -16,6 +16,8 @@ function computed_field_field_index_compute($entity_type_manager, $entity, $fiel
|
||||
|
||||
// the node is new
|
||||
// get all same entities in same family
|
||||
$bundle = $entity->bundle();
|
||||
$entity_type_id = $entity->getEntityTypeId();
|
||||
$query = \Drupal::entityQuery($entity->getEntityTypeId())
|
||||
->condition('type', $entity->bundle())
|
||||
->condition('field_famille', $famille)
|
||||
@@ -28,7 +30,7 @@ function computed_field_field_index_compute($entity_type_manager, $entity, $fiel
|
||||
if(is_array($nids)){
|
||||
$nid = array_pop($nids);
|
||||
if ($nid) {
|
||||
$last = entity_load($entity->getEntityTypeId(), array_pop($nids));
|
||||
$last = entity_load($entity->getEntityTypeId(), $nid); // array_pop($nids)
|
||||
// get identifiants fo these entities
|
||||
$index = $last->get('field_index')->getValue()[0]['value'] + 1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user