diff --git a/islandora_citations.info.yml b/islandora_citations.info.yml index 09de850..47f2714 100644 --- a/islandora_citations.info.yml +++ b/islandora_citations.info.yml @@ -2,7 +2,7 @@ name: Islandora citations type: module description: Provides a service to manage citations. package: Custom -core_version_requirement: ^9 +core_version_requirement: ^10 dependencies: - drupal:field_permissions - drupal:node diff --git a/src/Controller/IslandoraCitationsController.php b/src/Controller/IslandoraCitationsController.php index 47bd7ba..2576628 100644 --- a/src/Controller/IslandoraCitationsController.php +++ b/src/Controller/IslandoraCitationsController.php @@ -50,6 +50,7 @@ public function provideArguments($node_type) { ]; $fields = $this->entityFieldManager->getFieldDefinitions('node', $node_type); + $rows = []; foreach ($fields as $field_definition) { if (!empty($field_definition->getTargetBundle())) { @@ -93,6 +94,7 @@ public function paragraphsArguments($paragraphs_type) { ]; $fields = $this->entityFieldManager->getFieldDefinitions('paragraph', $paragraphs_type->id()); + $rows = []; foreach ($fields as $field_definition) { if (!empty($field_definition->getTargetBundle())) { $data = $field_definition->getThirdPartySetting('islandora_citations', 'csl_field'); diff --git a/src/Normalizer/DateTimeNormalizer.php b/src/Normalizer/DateTimeNormalizer.php index ffc5ed5..1c96e6f 100644 --- a/src/Normalizer/DateTimeNormalizer.php +++ b/src/Normalizer/DateTimeNormalizer.php @@ -57,9 +57,13 @@ public function normalize($datetime, $format = NULL, array $context = []) { assert($datetime instanceof DateTimeInterface); $drupal_date_time = $datetime->getDateTime()->setTimezone($this->getNormalizationTimezone()); if ($drupal_date_time === NULL) { - return $drupal_date_time; + return NULL; } + $date = $this->dateFormatter->format($drupal_date_time->getTimestamp(), 'custom', 'Y-m-d'); + + $element = []; + foreach ($context['csl-map'] as $cslField) { $element[$cslField] = $date; } diff --git a/src/Normalizer/NormalizerBase.php b/src/Normalizer/NormalizerBase.php index 0e3b9a8..42e83d3 100644 --- a/src/Normalizer/NormalizerBase.php +++ b/src/Normalizer/NormalizerBase.php @@ -18,8 +18,8 @@ abstract class NormalizerBase extends SerializationNormalizerBase implements Nor /** * {@inheritdoc} */ - public function supportsNormalization($data, $format = NULL) { - return $format === static::FORMAT && parent::supportsNormalization($data, $format); + public function supportsNormalization($data, ?string $format = NULL, array $context = []): bool { + return $format === static::FORMAT && parent::supportsNormalization($data, $format, $context); } /**