diff --git a/entityreference_prepopulate.module b/entityreference_prepopulate.module index 9c06140..f634358 100644 --- a/entityreference_prepopulate.module +++ b/entityreference_prepopulate.module @@ -92,12 +92,6 @@ function entityreference_prepopulate_field_attach_form($entity_type, $entity, &$ } $settings = $instance['settings']['behaviors']['prepopulate']; - if ((!empty($settings['skip_perm']) && user_access($settings['skip_perm'])) || ($id && empty($settings['action_on_edit']))) { - // User has access to skip the action, or the entity is already - // saved, but "Apply action on edit", is disabled. - continue; - } - $field = $value['field']; // Store prepopulated values in the form state to make them persistent, @@ -108,6 +102,12 @@ function entityreference_prepopulate_field_attach_form($entity_type, $entity, &$ $form_state['entityreference_prepopulate'][$instance['entity_type']][$instance['bundle']][$field_name] = $ids; } + if ((!empty($settings['skip_perm']) && user_access($settings['skip_perm'])) || ($id && empty($settings['action_on_edit']))) { + // User has access to skip the action, or the entity is already + // saved, but "Apply action on edit", is disabled. + continue; + } + if ($ids || ($id && !empty($settings['action_on_edit']))) { // New entity with prepopulate values, or an existing entity, // we might need to disable/ hide the group-audience field.