vendor/shopware/storefront/Resources/views/storefront/page/product-detail/review/review-form.html.twig line 1

Open in your IDE?
  1. {% block page_product_detail_review_form %}
  2.     {% if data is not defined and reviews.customerReview is defined %}
  3.         {% set data = reviews.customerReview %}
  4.     {% endif %}
  5.     {% set formAjaxSubmitOptions = {
  6.         replaceSelectors: '.js-review-container'
  7.     } %}
  8.     {% block page_product_detail_review_form_form %}
  9.         <form class="review-form"
  10.               action="{{ path('frontend.detail.review.save', { productId: reviews.productId }) }}"
  11.               method="post"
  12.               data-form-validation="true"
  13.               data-form-ajax-submit="true"
  14.               data-form-ajax-submit-options='{{ formAjaxSubmitOptions|json_encode }}'>
  15.             {# @deprecated tag:v6.5.0 - Block page_product_detail_review_form_csrf will be removed. #}
  16.             {% block page_product_detail_review_form_csrf %}
  17.                 {{ sw_csrf('frontend.detail.review.save') }}
  18.             {% endblock %}
  19.             {% block page_product_detail_review_form_forward %}
  20.                 <input type="hidden"
  21.                        name="forwardTo"
  22.                        value="frontend.product.reviews">
  23.                 <input type="hidden"
  24.                        name="parentId"
  25.                        value="{{ reviews.parentId }}">
  26.                 <input type="hidden"
  27.                        name="forwardParameters"
  28.                        value='{"productId": "{{ reviews.productId }}"}'>
  29.             {% endblock %}
  30.             {% if reviews.customerReview %}
  31.                 <input type="hidden" value="{{ reviews.customerReview.id }}" name="id"/>
  32.             {% endif %}
  33.             {% block page_product_detail_review_form_details %}
  34.                 <div class="{{ formRowClass }}">
  35.                     {% block page_product_detail_review_form_rating %}
  36.                         <div class="form-group col-md-4 product-detail-review-form-rating">
  37.                             <label for="#review-form-rating">
  38.                                 {{ "detail.reviewFormRatingLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  39.                             </label>
  40.                             <div id="review-form-rating"
  41.                                  class="product-detail-review-form-rating-input"
  42.                                  data-rating-system="true">
  43.                                 {% if data.get('points') is not empty %}
  44.                                     {% set currentPoints = data.get('points')|number_format %}
  45.                                 {% else %}
  46.                                     {% set currentPoints = reviews.matrix.maxPoints %}
  47.                                 {% endif %}
  48.                                 {% set maxPoints = reviews.matrix.maxPoints %}
  49.                                 {% for point in 1..maxPoints %}
  50.                                     <label data-review-form-point="{{ point }}"
  51.                                            class="product-detail-review-form-star{% if currentPoints >= point %} is-active{% endif %}">
  52.                                         <input class="product-detail-review-form-radio"
  53.                                                type="radio"
  54.                                                name="points"
  55.                                                value="{{ point }}"
  56.                                             {% if currentPoints >= point %} checked="checked"{% endif %}>
  57.                                         {% sw_include '@Storefront/storefront/component/review/point.html.twig' with {
  58.                                             type: 'blank'
  59.                                         } %}
  60.                                     </label>
  61.                                 {% endfor %}
  62.                                 {% for matrix in reviews.matrix.matrix %}
  63.                                     <p class="h6 product-detail-review-form-rating-text {% if currentPoints != matrix.points %} d-none{% endif %}"
  64.                                        data-rating-text="{{ matrix.points }}">
  65.                                         {{ "detail.review#{matrix.points}PointRatingText"|trans|sw_sanitize }}
  66.                                     </p>
  67.                                 {% endfor %}
  68.                             </div>
  69.                         </div>
  70.                     {% endblock %}
  71.                     {% block page_product_detail_review_form_title %}
  72.                         <div class="form-group col-12 product-detail-review-form-title">
  73.                             {% block page_product_detail_review_form_title_label %}
  74.                                 <label class="form-label" for="reviewTitle">
  75.                                     {{ "detail.reviewFormTitleLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  76.                                 </label>
  77.                             {% endblock %}
  78.                             {% block page_product_detail_review_form_title_input %}
  79.                                 <input type="text"
  80.                                        class="form-control{% if formViolations.getViolations('/title') %} is-invalid{% endif %}"
  81.                                        id="reviewTitle"
  82.                                        placeholder="{{ "detail.reviewFormTitlePlaceholder"|trans|striptags }}{{ "general.required"|trans|striptags }}"
  83.                                        name="title"
  84.                                        value="{{ data.get('title') }}"
  85.                                        required="required"
  86.                                        minlength="5">
  87.                             {% endblock %}
  88.                             {% block page_product_detail_review_form_title_violation %}
  89.                                 {% if formViolations.getViolations('/title') is not empty %}
  90.                                     {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' with {
  91.                                         violationPath: '/title'
  92.                                     } %}
  93.                                 {% endif %}
  94.                             {% endblock %}
  95.                         </div>
  96.                     {% endblock %}
  97.                 </div>
  98.             {% endblock %}
  99.             {% block page_product_detail_review_form_content %}
  100.                 <div class="form-group product-detail-review-form-content">
  101.                     {% block page_product_detail_review_form_content_label %}
  102.                         <label for="reviewContent">
  103.                             {{ "detail.reviewFormContentLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  104.                         </label>
  105.                     {% endblock %}
  106.                     {% block page_product_detail_review_form_content_textarea %}
  107.                         <textarea class="form-control{% if formViolations.getViolations('/content') %} is-invalid{% endif %}"
  108.                                   id="reviewContent"
  109.                                   name="content"
  110.                                   required="required"
  111.                                   minlength="40"
  112.                                   rows="8">{% if data.get('content') is not empty %}{{ data.get('content') }}{% endif %}</textarea>
  113.                     {% endblock %}
  114.                     {% block page_product_detail_review_form_content_violation %}
  115.                         {% if formViolations.getViolations('/content') is not empty %}
  116.                             {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' with {
  117.                                 violationPath: '/content'
  118.                             } %}
  119.                         {% endif %}
  120.                     {% endblock %}
  121.                 </div>
  122.             {% endblock %}
  123.             {% block page_product_detail_review_form_footer %}
  124.                 <div class="product-detail-review-form-footer">
  125.                     {% block page_product_detail_review_form_required %}
  126.                         <p class="required-fields">
  127.                             {{ "general.requiredFields"|trans|sw_sanitize }}
  128.                         </p>
  129.                     {% endblock %}
  130.                     <div class="product-detail-review-form-actions">
  131.                         {% block page_product_detail_review_form_cancel %}
  132.                             <a href="#"
  133.                                class="btn btn-outline-secondary product-detail-review-cancel"
  134.                                {{ dataBsToggleAttr }}="collapse"
  135.                                {{ dataBsTargetAttr }}=".multi-collapse"
  136.                                aria-expanded="false"
  137.                                aria-controls="review-form review-list">
  138.                                 {{ "detail.reviewFormCancelText"|trans|sw_sanitize }}
  139.                             </a>
  140.                         {% endblock %}
  141.                         {% block page_product_detail_review_form_submit %}
  142.                             <button type="submit"
  143.                                     class="btn btn-primary btn-review-submit">
  144.                                 {{ "detail.reviewFormSubmitText"|trans|sw_sanitize }}
  145.                             </button>
  146.                         {% endblock %}
  147.                     </div>
  148.                 </div>
  149.             {% endblock %}
  150.         </form>
  151.     {% endblock %}
  152. {% endblock %}