Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {#
- /**
- * @file
- * Bootstrap Paragraphs template for displaying a Carousel.
- *
- * Available variables:
- * - paragraph: Full paragraph entity.
- * - id: The paragraph ID.
- * - bundle: The type of the paragraph, for example, "image" or "text".
- * - authorid: The user ID of the paragraph author.
- * - createdtime: Formatted creation date. Preprocess functions can
- * reformat it by calling format_date() with the desired parameters on
- * $variables['paragraph']->getCreatedTime().
- * - content: All paragraph items. Use {{ content }} to print them all,
- * or print a subset such as {{ content.field_example }}. Use
- * {{ content|without('field_example') }} to temporarily suppress the printing
- * of a given child element.
- * - attributes: HTML attributes for the containing element.
- * The attributes.class element may contain one or more of the following
- * classes:
- * - paragraphs: The current template type (also known as a "theming hook").
- * - paragraphs--type-[type]: The current paragraphs type. For example, if the paragraph is an
- * "Image" it would result in "paragraphs--type--image". Note that the machine
- * name will often be in a short form of the human readable label.
- * - paragraphs--view-mode--[view_mode]: The View Mode of the paragraph; for example, a
- * preview would result in: "paragraphs--view-mode--preview", and
- * default: "paragraphs--view-mode--default".
- * - view_mode: View mode; for example, "preview" or "full".
- * - logged_in: Flag for authenticated user status. Will be true when the
- * current user is a logged-in member.
- * - is_admin: Flag for admin user status. Will be true when the current user
- * is an administrator.
- *
- * @see template_preprocess_paragraph()
- *
- * @ingroup themeable
- */
- #}
- {{ attach_library('varbase_bootstrap_paragraphs/vbp-default') }}
- {{ attach_library('varbase_bootstrap_paragraphs/vbp-colors') }}
- {{ attach_library('varbase_bootstrap_paragraphs/vbp-carousel') }}
- {# Background color. #}
- {% if content.bp_background|render %}
- {% set layout_background = content.bp_background['#items'].getString() %}
- {% set layout_background_classes = [ layout_background ] %}
- {% endif %}
- {# Renders Slide Interval field. #}
- {# Converts database values to classes supplied by template. #}
- {% if content.bp_slide_interval|render %}
- {% set slide_interval = content.bp_slide_interval['#items'].getString() %}
- {% set slide_interval_classes = [ slide_interval ] %}
- {% endif %}
- {# The template default set classes. #}
- {%
- set classes = [
- 'paragraph',
- 'paragraph--type--' ~ paragraph.bundle|clean_class,
- view_mode ? 'paragraph--view-mode--' ~ view_mode|clean_class,
- 'carousel',
- 'slide',
- ]
- %}
- {# Merges Background color with classes. #}
- {% set background_field = content.bp_background|render %}
- {% if background_field %}
- {% set classes = classes|merge(layout_background_classes) %}
- {% endif %}
- {# If there is BG image it's always edge to edge #}
- {% if (content.bp_background|render) %}
- {% set attributes = attributes.addClass('bg-edge2edge') %}
- {% endif %}
- {# Sets Unique ID for Carousel from Paragraph ID. #}
- {% set paragraph_id = 'myCarousel-' ~ paragraph.id.value %}
- {# Prints Carousel template. #}
- {{ content|without('bp_slide_content','bp_slide_interval', 'bp_width', 'bp_background') }}
- <div{{ attributes.addClass(classes).setAttribute( 'id', paragraph_id).setAttribute( 'data-interval', slide_interval_classes).setAttribute( 'data-ride', 'carousel') }} {% if VBP.background_image.url %} style="background-image:url({{- VBP.background_image.url -}});" {% endif %}>
- {{ title_suffix }}
- <div class="container">
- <div id="main_area">
- <!-- Slider -->
- <div class="row">
- <div class="col-sm-8">
- <ol class="carousel-indicators">
- {% for key, item in content.bp_slide_content if key|first != '#' %}
- <li class="{% if loop.first %}active{% endif %}" data-slide-to="{{ key }}" data-target="#{{ paragraph_id }}"></li>
- {% endfor %}
- </ol>
- <div class="carousel-inner" role="listbox">
- {% for key, item in content.bp_slide_content if key|first != '#' %}
- <div class="paragraph--layout-slideshow__slide-{{ key + 1 }} item carousel-item{% if loop.first %} active{% endif %}">{{ item }}</div>
- {% endfor %}
- </div>
- <a class="left carousel-control" href="#{{ paragraph_id }}" role="button" data-slide="prev">
- <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
- <span class="sr-only">Previous</span>
- </a>
- <a class="right carousel-control" href="#{{ paragraph_id }}" role="button" data-slide="next">
- <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
- <span class="sr-only">Next</span>
- </a>
- </div>
- <div class="col-sm-4" id="slider-thumbs">
- <!-- Bottom switcher of slider -->
- <ul class="hide-bullets hide-caption thumbs remove-padding">
- {% for key, item in content.bp_slide_content if key|first != '#' %}
- <li class="col-sm-4 {% if loop.first %}active{% endif %}" data-slide-to="{{ key }}" data-target="#{{ paragraph_id }}">
- <a class="thumbnail" id="carousel-selector-{{ key + 1 }}">{{ item }}</a>
- </li>
- {% endfor %}
- </ul>
- </div>
- </div>
- </div>
- </div>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement