1. Устанавливаем через composer в папке core:
    composer require mobiledetect/mobiledetectlib
  2. Создаем сниппет detectMobile, который будет отвечать за определение:
    <?php
    require_once MODX_CORE_PATH . '/vendor/autoload.php';
    
    $detect = new \Detection\MobileDetect;
    $deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer');
    
    if ($input == $deviceType) {
        return true;
    }
  3. Подключаем fenom и создаем правило в чанках или шаблоне:
    {if 'phone' | detectMobile}
     The phone detected
    {else}
    {/if}
← msFieldsManager. Быстрое изменение нескольких ценКаталог ядра в открытом доступе. Что делать? →