Use in adjacent module Forum

Created on 29 May 2023, over 1 year ago
Updated 19 July 2023, over 1 year ago

For D9 themes' *.html.twig templates it is possible to properly apply the mobile detection as:

{% if is_mobile() %}

{% endif %}

However, if i try to use the same condition for the forum module in forum-list.html.twig, no action occurs.

Previously, in D7 it was normally accessible as follows: (advanced-forum.naked.forum-list.tpl.php)

          require_once 'sites/all/libraries/Mobile_Detect/Mobile_Detect.php';
          $detect = mobile_detect_get_object();
          $is_mobile = $detect->isMobile();

if (!$is_mobile) {
}

elseif ($is_mobile) {
}

Could you help me to assign/render it, please?
It is necessary to rebuild html output for mobile forum table.

💬 Support request
Status

Closed: works as designed

Version

3.0

Component

Miscellaneous

Created by

🇷🇺Russia allexim

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @allexim
  • Status changed to Closed: cannot reproduce over 1 year ago
  • 🇧🇪Belgium nonom Brussels

    In Drupal 8+ you can try the following:

    $md = \Drupal::service('mobile_detect');
    $md->isMobile();
    $md->isTablet();
    
  • Status changed to Closed: works as designed over 1 year ago
  • 🇧🇪Belgium nonom Brussels
Production build 0.71.5 2024