|
|
|
@ -216,11 +216,9 @@ function bibcite_footnotes_inline_entity_form_entity_form_alter(&$form, FormStat
|
|
|
|
|
$form['#save_entity'] = TRUE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function bibcite_footnotes_form_node_form_alter($form, FormStateInterface $form_state) { |
|
|
|
|
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 = []; |
|
|
|
@ -246,7 +244,7 @@ function bibcite_footnotes_form_node_form_alter($form, FormStateInterface $form_
|
|
|
|
|
$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 = $entity->getOriginalId(); |
|
|
|
|
$citation_key = $entity->id->first()->getValue()['value']; |
|
|
|
|
$bibcite_references[] = [$citation_text, $citation_key]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -256,7 +254,7 @@ function bibcite_footnotes_form_node_form_alter($form, FormStateInterface $form_
|
|
|
|
|
|
|
|
|
|
$triggering_element = $form_state->getTriggeringElement(); |
|
|
|
|
if (!$triggering_element) { |
|
|
|
|
$form['#attached']['library'][] = 'bibcite_footnotes/replace_citations'; |
|
|
|
|
//$form['#attached']['library'][] = 'bibcite_footnotes/replace_citations'; |
|
|
|
|
$form['#attached']['drupalSettings']['bibcite_footnotes']['references'] = $bibcite_references; |
|
|
|
|
// $form['#attached']['drupalSettings'][''] |
|
|
|
|
} |
|
|
|
|