You are here

mobile-detect-status-block.html.twig in Mobile Detect 8.2

{# mobile_detect/templates/mobile-detect-status-block.html.twig #}
{% block mobile_detect %}

  {% set color = internal_cache ? 'red' : 'green' %}
  {% set status = internal_cache ? 'enabled' : 'disabled' %}

  <p>If you want to use the mobile_detect cache contexts to vary the content 
  served to anonymous users, "Internal Page Cache" must be disabled, 
  and the performance impact that entails incurred.</p>

  <p style="color: {{ color }}">Internal Page Cache module is {{ status }}</p>

  <ul>
    {% if is_mobile() %}
    <li><strong>Is Mobile</strong></li>
    {% endif %}
    {% if is_tablet() %}
    <li><strong>Is Tablet</strong></li>
    {% endif %}
    {% if not is_mobile() %}
    <li><strong>Is Desktop</strong></li>
    {% endif %}
    {% if not is_mobile() %}
    <li>Is Not Mobile</li>
    {% endif %}
    {% if not is_tablet() %}
    <li>Is Not Tablet</li>
    {% endif %}
    {% if is_mobile() %}
    <li>Is Not Desktop</li>
    {% endif %}
  </ul>
{% endblock %}

File

templates/mobile-detect-status-block.html.twig
View source
  1. {# mobile_detect/templates/mobile-detect-status-block.html.twig #}
  2. {% block mobile_detect %}
  3. {% set color = internal_cache ? 'red' : 'green' %}
  4. {% set status = internal_cache ? 'enabled' : 'disabled' %}
  5. <p>If you want to use the mobile_detect cache contexts to vary the content
  6. served to anonymous users, "Internal Page Cache" must be disabled,
  7. and the performance impact that entails incurred.</p>
  8. <p style="color: {{ color }}">Internal Page Cache module is {{ status }}</p>
  9. <ul>
  10. {% if is_mobile() %}
  11. <li><strong>Is Mobile</strong></li>
  12. {% endif %}
  13. {% if is_tablet() %}
  14. <li><strong>Is Tablet</strong></li>
  15. {% endif %}
  16. {% if not is_mobile() %}
  17. <li><strong>Is Desktop</strong></li>
  18. {% endif %}
  19. {% if not is_mobile() %}
  20. <li>Is Not Mobile</li>
  21. {% endif %}
  22. {% if not is_tablet() %}
  23. <li>Is Not Tablet</li>
  24. {% endif %}
  25. {% if is_mobile() %}
  26. <li>Is Not Desktop</li>
  27. {% endif %}
  28. </ul>
  29. {% endblock %}