Hello Sandor,
Ok, the Alternative text should be used only when you are inserting the media library file directly into the Editable region.
In this case I would recommend you the following solution:
1. Create a custom form control which will be copy of
\CMSFormControls\Basic\MediaSelectionControl.ascx (+ .cs file)
with name e.g. MediaImageSelectionControl.ascx
2. Open this control in VS and add a Text field where alternative text will be entered:
<asp:TextBox ID="txtAlt" runat="server" />
<cms:MediaSelector ID="mediaSelector" runat="server" />
3. Make some changes in the code-behind (cs) file to handle alternative text correctly:
at the beginning of your class create a private variable:
#region "variables"
private string altText = "";
#endregion
modify the Value object:
public override object Value
{
get
{
return mediaSelector.Value + "|" + txtAlt.Text;
}
set
{
string myValue = ValidationHelper.GetString(value, null);
mediaSelector.Value = myValue.Split('|')[0];
altText = myValue.Split('|')[1];
}
}
at the beginning of
Page_Load method assign this variable:
protected void Page_Load(object sender, EventArgs e)
{
txtAlt.Text = altText;
...
You can also modify a dialog to accept only images as media files for this selector:
mediaConfig.SelectableContent = SelectableContentEnum.OnlyImages;4. In the
CMS Site Manager -> Development -> Form controls , create a new Form Control -> Media Image Selection
5. Add new field to your document type with this new control, the alternative text will be then parsed automatically and you will be able to work with this field
Best Regards,
Martin Danko