This module uses the Mobile_Detect library to add Twig extensions related with mobile devices. It's a port I did time ago so credits are going for @mpdonadio

NOTE: This module is now merged with Mobile_detect.

Please switch to Mobile_detect ASAP because we moved to the main project.

Features from this module into Mobile_detect

  • Twig extensions
  • Php snippets
  • Uses composer to bring the MobileDetect library (thanks @sarathkm)

PHP Snippets

$detector = \Drupal::service('mobile_detect');
$detector->isMobile();
$detector->isTablet()

Twig Extensions

{% if is_mobile() %}
{% if is_tablet() %}

Drupal 7.x
Please check https://www.drupal.org/project/mobile_detect

Project information

Releases