You are here

private function MobileDeviceDetection::init in Mobile Device Detection 8.2

Same name and namespace in other branches
  1. 8.3 src/Object/MobileDeviceDetection.php \Drupal\mobile_device_detection\Object\MobileDeviceDetection::init()
1 call to MobileDeviceDetection::init()
MobileDeviceDetection::__construct in src/Object/MobileDeviceDetection.php
The constructoror.

File

src/Object/MobileDeviceDetection.php, line 56

Class

MobileDeviceDetection
MobileDeviceDetection object.

Namespace

Drupal\mobile_device_detection\Object

Code

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