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-416: Add fall-back logic for default image #26

Merged
merged 9 commits into from
Aug 27, 2024

Conversation

prashant-dgi
Copy link
Contributor

No description provided.

Copy link
Contributor

@MorganDawe MorganDawe left a comment

Choose a reason for hiding this comment

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

Smoke testing and found one or two artifacts that need to be cleaned up.

@@ -131,8 +134,51 @@ public function addFieldValues(ItemInterface $item) {
if ($generated_url) {
$field->addValue($generated_url->getGeneratedUrl());
}
else {
// Fallback to default image if URL generation fails.
$default_image_url = $this->getDefaultImageFromTaxonomy($entity, $image_style_name);
Copy link
Contributor

Choose a reason for hiding this comment

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

Given what is intended, i think the $image_style_name variable being passed in getDefaultImageFromTaxonomy should be $config['image_style']

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I pushed the updated code.

foreach ($model_terms as $term) {
if ($term instanceof Term) {
// Load the media entity referenced by the field_defaultimage.
$media = $term->get('field_defaultimage')->entity;
Copy link
Contributor

Choose a reason for hiding this comment

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

The field is missing an underscore, should be field_default_image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I pushed the updated code.

- In the Islandora Models vocabulary, select the appropriate default image for each term.

This setup allows the module to associate a default thumbnail (TN) with objects that lack a specific thumbnail for any given content type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@MorganDawe updated the README file.

@dynac01 dynac01 added the minor Added functionality that is backwards compatible. label Aug 27, 2024
@dynac01 dynac01 merged commit 9ccac04 into discoverygarden:main Aug 27, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Added functionality that is backwards compatible.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants