Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DDST-312: Addressing a warning when search_endpoint option isn't set #1035

Merged
merged 2 commits into from
Jul 7, 2024

Conversation

nchiasson-dgi
Copy link

GitHub Issue: N/A

What does this Pull Request do?

Adds a null coalescing operator when attempting to read the search_endpoint option and a null-check in the event that it hasn't been set, and handle the following warning:

Warning: Undefined array key "search_endpoint" in Drupal\islandora_iiif\Plugin\views\style\IIIFManifest->addSearchEndpoint() (line 497 of path/to/files/islandora/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php).

What's new?

Adds a null coalescing operator when attempting to read the search_endpoint variable. Then performs a null-check before executing operations with that value that may not exist.

  • Does this change add any new dependencies? No.
  • Does this change require any other modifications to be made to the repository
    (i.e. Regeneration activity, etc.)? No.
  • Could this change impact execution of existing code? Yes.

How should this be tested?

Load a page where the addSearchEndpoint function is called, but the search_endpoint option is not set.

Interested parties

@Islandora/committers

@seth-shaw-asu seth-shaw-asu requested a review from alxp July 3, 2024 17:17
Copy link

@alxp alxp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@alxp alxp merged commit 60a1678 into Islandora:2.x Jul 7, 2024
0 of 27 checks passed
@nchiasson-dgi nchiasson-dgi deleted the fix/empty_search_endpoint branch July 8, 2024 13:15
@adam-vessey adam-vessey changed the title Addressing a warning when search_endpoint option isn't set DDST-312: Addressing a warning when search_endpoint option isn't set Jul 9, 2024
@@ -494,17 +494,20 @@ protected function defineOptions() {
*/
protected function addSearchEndpoint(array &$json, array $url_components) {
$url_base = $this->getRequest()->getSchemeAndHttpHost();
$hocr_search_path = $this->options['search_endpoint'];
$hocr_search_url = $url_base . '/' . ltrim($hocr_search_path, '/');
$hocr_search_path = $this->options['search_endpoint'] ?? null;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this introduced a little coding standards thing: #1040

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants