Render entered alt text from image instead of caption
Hi all
I would like to alter the partials/grid/editors/media.cshtml file so it renders the alt text entered instead of the caption. Cause I want to remove the caption option.
So my question is: What do I have to change @Model.value.caption to?
The alt text is entered before you insert the image into the grid.
Render entered alt text from image instead of caption
Hi all
I would like to alter the partials/grid/editors/media.cshtml file so it renders the alt text entered instead of the caption. Cause I want to remove the caption option.
So my question is: What do I have to change @Model.value.caption to?
The alt text is entered before you insert the image into the grid.
Any pointers on how to do this? :)
Hi Michael,
Yes this is an open issue at the moment with Umbraco:
see: http://issues.umbraco.org/issue/U4-6193
the alternative text is never passed back from the media picker and saved inside the grid, otherwise you could write Model.value.altText
If you are desperate to get this working then you could temporarily edit the file:
\Umbraco\Js\umbraco.controllers.js
find .Controller("Umbraco.PropertyEditors.Grid.MediaController")
as per the fix outlined in the issue
and add altText: data.altText line to the $scope.control.value setting
this would allow you to use the altText in the view...
Hi Marc
Thank you for the reply. I finally got around to try it out.
I updated my umbraco.controllers.js and my media.cshtml. I still can't get it to work. I will keep playing with it.
/Michael
Did anyone get this resolved? Have the same issue after updating the 2 files above?
Hi J,
This issue is marked as fixed in Umbraco 7.3+ so you shouldn't need to do this in the latest versions of Umbraco.
If you are pre 7.3...
then make sure you clear the client dependency framework by upping the version no in (/config/clientdependency.config)
to make sure Umbraco is using the updated versions of the files
regards
Marc
Thanks Marc, so far it doesnt work. My steps:
Changed js\umbraco.controllers.js added the below
In media.cshtml changed line 17 to
under config\Clientdependency.config
Changed
changed version to 12345679
Am i missing something as when i refresh the page alt text is still not shown? So i added a manual alt entry in the cshtml file which does display?
Thanks
Hi J
Yes, that's all it should need, - which version of Umbraco is this ? (and I'll try to replicate)
the grid has changed slightly in the later versions (but then also this problem has been fixed).
I'd try adding a console.log of the data to see if the altText is being returned from the mediaPicker dialog service correctly:
is working on a reply...