Use in adjacent module Forum

Created on 29 May 2023, about 1 year ago
Updated 19 July 2023, 12 months 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 12 months 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 12 months ago
  • πŸ‡§πŸ‡ͺBelgium nonom Brussels
Production build 0.69.0 2024