Closed (fixed)
Project:
Google Programmable Search Engine
Version:
8.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 Oct 2020 at 14:17 UTC
Updated:
22 Apr 2021 at 18:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
jwilson3Comment #3
jwilson3Comment #4
jwilson3Comment #5
jwilson3Comment #6
juanolalla commentedGreat work, thanks @jwilson3.
It works well but I don't get why you use
'variables' => ['message' => ''],in the theme function instead of no_results_message.Comment #7
jwilson3Good point @juanolalla.
That's a mistake.
'variables' => ['message' => ''],was a vestige of my first approach at writing the code in a different way.AFAICT simply removing that line should have no negative effect, but this needs to be tested.
Comment #9
mark_fullmerThanks for the report and the proposed patch. That theme implementation certainly is deprecated, so we should do something about it, but I first have a couple questions.
I'd been involved in the resolution of #3159988: Remove references to "Google CSE Advanced" awhile back, during which time we discovered that most of the configuration provided by this plugin was added in a long time ago as an attempt to merge the base Google CSE functionality with a now-deprecated Google API for advanced options. Our discovery was that most of the configuration in the plugin in nonfunctional.
Therefore, can you provide steps of under what circumstances the "No results" input is being honored/displayed? When I test the behavior and input a string that will generate no results, I only see the Google Javascript-provided results, not anything generated from a Drupal theme function.
I could be missing something, but looking at the code, also don't see how the no results behavior would end up on a page. Before, and after this patch, there is a
hook_theme()implementation registered in the .module file, but there is nowhere in code that actually calls that theme function.Specifically, I did a search for the string
google_cse_search_noresultsthroughout the module. There was no render invocation via#theme. In contrast, for example, there are invocations of the maingoogle_cse_resultstheme function.If I am correct and the no results behavior actually is nonfunctional, I propose we just remove the functionality related to "No results" to resolve the deprecation problem. That's a subset of everything that needs to be removed, but it's a start. Merge request coming.
Comment #11
mark_fullmerThe provided merge request in https://git.drupalcode.org/project/google_cse/-/merge_requests/1 completely removes the non-functional "No results" behavior, including the input on the configuration form.
As a byproduct, this fixes the Drupal 10 deprecation warning of using a theme function directly in
hook_themethat was the cause of this original issue report.Setting to "Needs Review."
If the reviewer(s) agree that the no results behavior is non-functional and should be removed, the issue title should be changed to reflect the focus to "Remove non-functional no results behavior."
Comment #12
superfluousapostrophe commented@mark_fullmer I think you are right. When I worked on the patch for #3094772, I was never able to trigger that particular function. As you suggested, the entirety of the results appear to come straight from the Google side of things. I think it would be fine to remove that code.
Comment #13
mark_fullmerI've changed the issue title and updated the description to capture the new scope/intent.
Comment #14
superfluousapostrophe commentedThe changes in merge request in #10 work for me. I don't see any other issues with removing the code relating to no search results.
Comment #15
ccjjmartin commentedAt first I wondered why we were removing the code in the MR but not in the original patch, after looking over this issue this makes sense to me and functionally this checks out too. Marking this as RTBC.
Comment #17
mark_fullmer