Created
May 28, 2015 23:07
-
-
Save favrik/808995f6a08e18834356 to your computer and use it in GitHub Desktop.
Allow duplicate entities
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/public/profiles/ritualcleanse/modules/contrib/inline_entity_form/inline_entity_form.module b/public/profiles/ritualcleanse/modules/contrib/inline_entity_form/inline_entity_form.module | |
index 0e39c5d..490f00e 100644 | |
--- a/public/profiles/ritualcleanse/modules/contrib/inline_entity_form/inline_entity_form.module | |
+++ b/public/profiles/ritualcleanse/modules/contrib/inline_entity_form/inline_entity_form.module | |
@@ -466,9 +466,15 @@ function inline_entity_form_field_widget_form(&$form, &$form_state, $field, $ins | |
} | |
$delta = 0; | |
- foreach (entity_load($settings['entity_type'], $entity_ids) as $entity) { | |
+ // Allow duplicate entities. | |
+ $loaded_entities = entity_load($settings['entity_type'], $entity_ids); | |
+ foreach ($entity_ids as $entity_id) { | |
+ if (!isset($loaded_entities[$entity_id])) { | |
+ continue; | |
+ } | |
+ | |
$form_state['inline_entity_form'][$ief_id]['entities'][$delta] = array( | |
- 'entity' => $entity, | |
+ 'entity' => $loaded_entities[$entity_id], | |
'weight' => $delta, | |
'form' => NULL, | |
'needs_save' => FALSE, | |
@@ -1101,12 +1107,15 @@ function inline_entity_form_reference_form_validate(&$reference_form, &$form_sta | |
// Check to see if entity is already referenced by current IEF widget | |
if (!empty($attach_entity)) { | |
+ // Allow duplicate values. | |
+ /* | |
foreach ($form_state['inline_entity_form'][$ief_id]['entities'] as $key => $value) { | |
if ($value['entity'] == $attach_entity) { | |
form_set_error($parents_path . '][existing_entity', t('The selected @label has already been added.', array('@label' => $labels['singular']))); | |
unset($attach_entity); | |
} | |
} | |
+ */ | |
} | |
else { | |
form_set_error($parents_path . '][existing_entity', t('The selected @label is not valid.', array('@label' => $labels['singular']))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment