Alexander O'Neill 6 years ago
parent
commit
a49d463d13
  1. 7
      bibcite_footnotes.module

7
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) { function bibcite_footnotes_inline_entity_form_entity_form_alter(&$form, FormStateInterface &$form_state) {
$form['#save_entity'] = TRUE; $form['#save_entity'] = TRUE;
}
function bibcite_footnotes_form_node_form_alter($form, FormStateInterface $form_state) {
$ief = $form_state->get('inline_entity_form'); $ief = $form_state->get('inline_entity_form');
if ($ief) { if ($ief) {
$serializer = \Drupal::service('serializer'); $serializer = \Drupal::service('serializer');
// Inline entity storage uses hashes to separate out the field instances. // Inline entity storage uses hashes to separate out the field instances.
$bibcite_references = []; $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_text = trim(strip_tags(render($build)));
$citation_hash = md5(implode('', $data)); $citation_hash = md5(implode('', $data));
// Attempt to match up pre-saved entities with the eventual saved ones. // 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]; $bibcite_references[] = [$citation_text, $citation_key];
} }
} }

Loading…
Cancel
Save