- Issue created by @apaderno
- ๐ช๐ธSpain fjgarlin
The issue is that there are many results that match exactly that name.
So the best "guess" is to actually make a search: https://api.drupal.org/api/drupal/11.x/search/Image
You can then filter by "object type" by typing "class". The default view is sorted by title.I think these generic names will always be tricky.
- ๐ฎ๐นItaly apaderno Brescia, ๐ฎ๐น
If the search page shows all the classes whose name matches exactly Image, that would be fine. It is a little confusing that the autocomplete is telling me there is a class whose name is a perfect match for Image, but then it shows a page where the first results are AdminUiTest::testImageUploadSettingsAreValidated, AjaxFormImageButtonTest, AjaxFormImageButtonTest.php, AjaxFormImageButtonTest::$defaultTheme, and AjaxFormImageButtonTest::$modules.
It is like it is saying I know there is a class whose name is Image, but I cannot find it.
The problem is that it does not even allow to be more specific, because entering also the class namespace (Drupal\Core\Image\Image) shows No search results found. With Drupal\Core\Image\ImageFactory, it instead takes to a page showing the definition of a service.
- ๐ช๐ธSpain fjgarlin
I thought about this, and since we already have the exact matches at that point before rendering the view, then why not offer links to those exact matches AND the search results for all the rest.
It would look like this:
And behave like this: recording โ
- Status changed to Needs review
11 months ago 9:22am 23 May 2024 - ๐ช๐ธSpain fjgarlin
MR which does what is shown above: https://git.drupalcode.org/project/api/-/merge_requests/36/diffs
- ๐ฎ๐นItaly apaderno Brescia, ๐ฎ๐น
Giving the links for the direct matches help much. I like it!
I would eventually limit the number of links for the direct matches shown in the page, but I understand that not showing all the direct matches (at that point) would not be much helpful (and I would rather not complicate the code too much).
- ๐ฎ๐นItaly apaderno Brescia, ๐ฎ๐น
If it were possible to use a view for the direct matches link and a view for the search results, that would be fantastic, but I would not want to make it all more complicated than needed.
- Status changed to Needs work
11 months ago 1:55pm 23 May 2024 - ๐ช๐ธSpain fjgarlin
We can definitely play with the rendering options as we are building a render array, so we could build a table that looks like a view. As per limiting, I initially added an
array_slice
but also thought that the number of exact matches within a branch should never be too big.I will play a bit with the rendering options.
- Status changed to Needs review
11 months ago 8:13am 24 May 2024 - ๐ช๐ธSpain fjgarlin
Same as the previous but now rendered as a table matching the style of all the other results:
- ๐ช๐ธSpain fjgarlin
Yeah, I like it better this way too, thanks for the suggestion. Should I take your above comment as RTBC?
- Status changed to RTBC
11 months ago 8:35am 27 May 2024 - ๐ฎ๐นItaly apaderno Brescia, ๐ฎ๐น
It gets a R&TBC from me. I was waiting for somebody else to chime in, but since nobody did chime inโฆ
-
fjgarlin โ
committed 3bf73d42 on 2.x
Issue #3449104 by fjgarlin, apaderno: Autocomplete shows a class name...
-
fjgarlin โ
committed 3bf73d42 on 2.x
- Status changed to Fixed
11 months ago 8:36am 27 May 2024 - ๐ช๐ธSpain fjgarlin
Cool. I'll merge it and deploy to api.drupal.org today. Thanks for creating the issue and for the suggestions.
- ๐ฎ๐นItaly apaderno Brescia, ๐ฎ๐น
Thank you for all your work on the drupal.org sites!
- ๐ช๐ธSpain fjgarlin
Deployed to staging site and it looks good: https://api.stage.cluster.drupalsystems.org/api/drupal/11.x/search/Image
So I will deploy to production shortly. Automatically closed - issue fixed for 2 weeks with no activity.