Skip to content

Commit

Permalink
DGIR-130 : Error handling for Cite this block and text changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Prashant-bd committed Dec 12, 2023
1 parent 14cad88 commit 1e5bea3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/Form/SelectCslForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,15 @@ public function buildForm(array $form, FormStateInterface $form_state) {
}
$csl = !empty($default_csl) ? $this->getDefaultCitation($default_csl) : '';

// Due to normalisation we receive errors in string and then it display
// same string as output.
// We expect output in a specific format ex:
// We receive error message as a string, and then we display same string
// as output.
// We expect output in a specific format when there is no error as below
// <div class="csl-bib-body">
// <div class="csl-entry">“Text_Output”</div>
// </div>.
// When there is an error we don't have above div structure.
// Based on that we will do the error handling.
// Based on `csl` text output, we will do the error handling.
// When HTML output is not as expected, add a form element which indicates
// we received error.
if (!str_starts_with($csl, '<div class="csl-bib-body">')) {
// Add a custom markup element to the form.
$form['error_handling_element'] = [
Expand Down

0 comments on commit 1e5bea3

Please sign in to comment.