From a49d463d13d48333dbfdb81e87ff8e85aaa9bf75 Mon Sep 17 00:00:00 2001 From: Alexander O'Neill Date: Tue, 27 Nov 2018 16:14:28 -0400 Subject: [PATCH] WIP --- bibcite_footnotes.module | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bibcite_footnotes.module b/bibcite_footnotes.module index 5644401..5f2d31b 100644 --- a/bibcite_footnotes.module +++ b/bibcite_footnotes.module @@ -214,8 +214,13 @@ function bibcite_footnotes_preprocess_bibcite_footnote_link(&$variables) { function bibcite_footnotes_inline_entity_form_entity_form_alter(&$form, FormStateInterface &$form_state) { $form['#save_entity'] = TRUE; +} + +function bibcite_footnotes_form_node_form_alter($form, FormStateInterface $form_state) { $ief = $form_state->get('inline_entity_form'); if ($ief) { + + $serializer = \Drupal::service('serializer'); // Inline entity storage uses hashes to separate out the field instances. $bibcite_references = []; @@ -241,7 +246,7 @@ function bibcite_footnotes_inline_entity_form_entity_form_alter(&$form, FormStat $citation_text = trim(strip_tags(render($build))); $citation_hash = md5(implode('', $data)); // Attempt to match up pre-saved entities with the eventual saved ones. - $citation_key = !empty($entity->getOriginalId()) ? $entity->getOriginalId() : $citation_hash; + $citation_key = $entity->getOriginalId(); $bibcite_references[] = [$citation_text, $citation_key]; } }