diff --git a/src/Form/SelectCslForm.php b/src/Form/SelectCslForm.php index c895662..7c45ce0 100644 --- a/src/Form/SelectCslForm.php +++ b/src/Form/SelectCslForm.php @@ -136,7 +136,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { ]; // Log error message. - $this->logger->error($csl); + $this->logger->error(json_encode($csl)); return $form; } @@ -225,7 +225,7 @@ public function getDefaultCitation($csl_name) { try { // Method call to render citation. $rendered = $this->renderCitation($csl_name); - return $rendered['data']; + return $rendered['data'] ?? NULL; } catch (\Throwable $e) { return $e->getMessage(); diff --git a/src/Normalizer/NormalizerBase.php b/src/Normalizer/NormalizerBase.php index b55f068..687dca3 100644 --- a/src/Normalizer/NormalizerBase.php +++ b/src/Normalizer/NormalizerBase.php @@ -89,7 +89,7 @@ protected function getNameParts(string $name): array { $firstName = trim(preg_replace('#' . preg_quote($lastName, '#') . '#', '', $name)); } - if (empty($firstName) && empty($lastName)) { + if (empty($firstName) || empty($lastName)) { throw new \Exception('Name is not formatted properly'); }