Skip to content
This repository has been archived by the owner on Apr 30, 2020. It is now read-only.

SliderMedia Component - Partials Logic #249

Open
BiOZed opened this issue Jul 7, 2017 · 1 comment
Open

SliderMedia Component - Partials Logic #249

BiOZed opened this issue Jul 7, 2017 · 1 comment
Assignees

Comments

@BiOZed
Copy link
Contributor

BiOZed commented Jul 7, 2017

The Image and OembedVideo partials are working differently. The Image accesses the image using mediaSlide.image.src, while the OembedVideo only has access to the mediaSlider.image because of the only parameter in the include statemnt.

I believe the two partials should loaded the same way. Any thoughts on which way would make most sense ?

@dgrdl
Copy link
Contributor

dgrdl commented Jul 17, 2017

I agree. I would go with the shorter, non-nested variables and add the only statement to the parent. My reasoning is that a partial should not have to depend on the variable naming and structure of the parent.

So, how about something like this?

{% if mediaSlide.mediaType == 'image' %}
  {% include 'Partials/Image/index.twig' with {'image': mediaSlide.image } only %}
{% elseif mediaSlide.mediaType == 'oembed' %}
  {% include 'Partials/OembedVideo/index.twig' with {'posterImage': mediaSlide.image, 'oembedLazyLoad': mediaSlide.oembedLazyLoad } only %}
{% endif %}
{% include 'Partials/SlideTitle/index.twig' with {'titleText': mediaSlide.titleText } only %}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants