You are here

private function MobileDeviceDetectionObject::init in Mobile Device Detection 8

1 call to MobileDeviceDetectionObject::init()
MobileDeviceDetectionObject::__construct in src/Object/MobileDeviceDetectionObject.php
The constructoror

File

src/Object/MobileDeviceDetectionObject.php, line 54

Class

MobileDeviceDetectionObject

Namespace

Drupal\mobile_device_detection\Object

Code

private function init() {
  $this
    ->setMobileHeaders(\Drupal::request()->server
    ->all());
  $this
    ->setCloudHeaders(\Drupal::request()->server
    ->all());
  $this
    ->setUserAgentHeaders($this
    ->getAttributes()
    ->get('user_agent_headers'));
  $this->object->type = null;
  if ($this
    ->check('mobile')) {
    $this->object->type = 'mobile';
  }
  if ($this
    ->check('tablet')) {
    $this->object->type = 'tablet';
  }
}