Alt text is not mapped

I have a ImageProperty in a pagetype. And it looks like this in the CMS

But the ALT text is not mapped to the image model by the automapper.

image

image

Why is the alt text not mapped? Something im missing?

Litium version: 6.2.3

Feels like a bug, I tested and I also got null for that property.

Will it go faster if you verify and report it? I can’t imaging it’s a big bug fix and could be fixed fast in a minor release?

It does not matter who reports it, it will be fixed after prioritization.
You can report a bug on that :slight_smile:

You could extend the PropertyUtilities with a method GetImageAltPropertyValue like below, and then use it to set the value.

public static string GetImageAltPropertyValue(PropertyCollection propertyCollection, string propertyName)
{
	var property = propertyCollection.GetProperty(propertyName) as ImageBaseProperty;

	if (property != null)
		return property.GetAltText();

	return null;
}

model.Image1.Alt = PropertyUtilities.GetImageAltPropertyValue(currentPageDefinition.CurrentPage.Content, nameof(currentPageDefinition.Image1));

1 Like

It’s reported as a bug, but i will use Nils solution in the mean while. Thanks!

1 Like

@steve.redstorm @NilsN Can you also help me verify the “BildText” field, does that even have a property on ImageModel?

There’s also a .GetTitle() method of the image property that gets you the Bildtext field value. The ImageModel has a Title property.

Looks like the default accelerator uses the alt text as figcaption though, but you could use the property above instead.

This feels very strange right? This means the accellerators image handling is pretty broken?

Right now ImageModel.Title is the name of the image. (Same as ImageModel.FileName) So i guess thats a bug aswell

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.