+ // Add the duplicate button, if allowed.
+ if ($settings['allow_duplicate'] && !$cardinality_reached && $entity->access('create')) {
+ $row['actions']['ief_entity_duplicate'] = [
+ '#type' => 'submit',
+ '#value' => $this->t('Duplicate'),
+ '#name' => 'ief-' . $this->getIefId() . '-entity-duplicate-' . $key,
+ '#limit_validation_errors' => [array_merge($parents, ['actions'])],
+ '#ajax' => [
+ 'callback' => 'inline_entity_form_get_element',
+ 'wrapper' => $wrapper,
+ ],
+ '#submit' => ['inline_entity_form_open_row_form'],
+ '#ief_row_delta' => $key,
+ '#ief_row_form' => 'duplicate',
+ ];
+ }
+