You are here

private function MobileDeviceDetection::init in Mobile Device Detection 8.3

Same name and namespace in other branches
  1. 8.2 src/Object/MobileDeviceDetection.php \Drupal\mobile_device_detection\Object\MobileDeviceDetection::init()

Initialization.

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

File

src/Object/MobileDeviceDetection.php, line 66

Class

MobileDeviceDetection
MobileDeviceDetection object.

Namespace

Drupal\mobile_device_detection\Object

Code

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