0

I am using Sitecore 9.0.1 with SXA 1.7. We have a requirement for video component with some extra fields so I have cloned the existing video component and added a custom field for it and I want to show that custom field in the Experience Editor like MovieCaption and MovieDescription which is shown in existing SXA video component.

I want to show my custom field along with those 2 text editor options.

enter image description here

Can anyone please help how can i achieve that?

Thanks

1 Answer 1

2

Take a look on the original View for OOTB Video component located under $path_to_sitecore_instance$\Views\Video\Video.cshtml:

enter image description here

Copy those 3 highlighted lines either for Caption or Description fields:

<div class="video-caption">
                @Html.Sxa().Field("MovieCaption", Model.DataSourceItem, Model.GetRenderingWebEditingParams())
            </div>

Change the definition of which field to change: @Html.Sxa().Field("MovieCaption", Model.DataSourceItem, Model.GetRenderingWebEditingParams()) to your desired by replacing "MovieCaption" with "My-custom-field-name"

Don't forget not to do this in OOTB Video View cshtml file. But create your own by copying the original cshtml file, make above changes and then set Rendering View Path on your custom Video component (cloned from OOTB one):

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.