ISAICP-6575: Search result index new view modes (search_result_featured, search_result).#2541
ISAICP-6575: Search result index new view modes (search_result_featured, search_result).#2541
Conversation
… set the display for all datasources to search_result.
|
I started with a manual test. The 'Video' and 'Licence' bundles are not appearing styled as a A comment made by Theo on the Jira ticket contains details about how the UI pattern should be configured. I don't see this appearing in the styling. For example the following specification would cause the content to be split in a small left column and a wide right column, but I don't see this on the screen: |
| {% block content %} | ||
| {{ pattern('card', { | ||
| 'variants': 'horizontal', | ||
| 'url': url, | ||
| 'title': { 'content': label }, | ||
| 'content': content, | ||
| }) }} | ||
| {% endblock %} |
There was a problem hiding this comment.
I see that many of these templates are identical. We can deduplicate them by "base templates" that can be used by all nodes and RDF entities:
node--search-result.html.twigrdf-entity--search-result.html.twig
Then in case there are any bundles that need to have a custom template for some reason, we can still override the base template by defining node--{bundle}--search-result.html.twig.
| 'content': content|without('field_news_logo'), | ||
| 'image': content.field_news_logo, |
There was a problem hiding this comment.
The custom page bundle doesn't have the field_news_logo field, this is probably forgotten to be updated after copy/pasting from the News template.
This indicates that we are missing test coverage for this. I don't know how these "featured" search items are supposed to be visible? Is this already implemented? If we can already see them in some way then we should add a test that ensures the right image is shown for each bundle that can appear as a featured search item.
| 'content': content|without('field_news_logo'), | ||
| 'image': content.field_news_logo, |
There was a problem hiding this comment.
This is a discussion, so there is no field_news_logo, same as above. Let's double check this for all bundles.
| 'content': content|without('field_ar_logo'), | ||
| 'image': content.field_ar_logo, |
There was a problem hiding this comment.
If this image field is the only thing that varies across all bundles, then we can solve this in a cleaner way in a preprocess function rather than providing a unique template for each bundle.
We can remove the image from the view mode in the field UI, then it will no longer be part of it.
Then we replace this section in the template with:
'content': content,
'image': image,
Now we just need to provide the image variable but this can be done cleanly in a preprocess function, it might look something like this:
function ventuno_preprocess_rdf_entity__search_result(&$variables) {
$entity = $variables['rdf_entity'];
$variables['image'] = $entity instanceof LogoInterface ? $entity->getLogoAsRenderArray() : NULL;
}
idimopoulos
left a comment
There was a problem hiding this comment.
In addition to Pieter's comments, there is also a test failure. The test failure seems to derive by the fact that the new view modes, "search result" and "search result featured" do not seem to display contextual links at the moment (configuration miss?). Please, fix the test as well.
…rid of the joinup_material_design dependency.
No description provided.