Skip to content

Commit

Permalink
Merge pull request #55 from discoverygarden/fix/d10-102-2
Browse files Browse the repository at this point in the history
D10-102: D10 support
  • Loading branch information
nchiasson-dgi authored Nov 3, 2023
2 parents 5d469ea + f97ab8c commit 5b5f9cc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion islandora_citations.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/Controller/IslandoraCitationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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())) {
Expand Down Expand Up @@ -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');
Expand Down
6 changes: 5 additions & 1 deletion src/Normalizer/DateTimeNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Normalizer/NormalizerBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit 5b5f9cc

Please sign in to comment.