src/Controller/Component/MobileComponent.php
protected function _init() {
		$mobileOverwrite = $this->Controller->getRequest()->getQuery('mobile');

		if ($mobileOverwrite !== null) {
			if ($mobileOverwrite === '-1') {
				$this->Controller->getRequest()->getSession()->delete('User.mobile');
			} else {
				$wantsMobile = (bool)$mobileOverwrite;
				$this->Controller->getRequest()->getSession()->write('User.mobile', (int)$wantsMobile);
			}
		}
		$this->isMobile();

		if (!$this->_config['auto']) {
			return;
		}
		$this->setMobile();
	}
protected function _init() {
		$mobileOverwrite = $this->Controller->getRequest()->getQuery('mobile');

		if ($mobileOverwrite !== null) {
			if ($mobileOverwrite === '-1') {
				$this->Controller->getRequest()->getSession()->delete('User.mobile');
			} else {
				$wantsMobile = (bool)$mobileOverwrite;
				$this->Controller->getRequest()->getSession()->write('User.mobile', (int)$wantsMobile);
			}
		}
		$this->isMobile();

		if (!$this->_config['auto']) {
			return;
		}
		$this->setMobile();
	}
protected function _init ( ) { $ mobileOverwrite = $ this -> Controller -> getRequest ( ) -> getQuery ( 'mobile' ) ; if ( $ mobileOverwrite !== null ) { if ( $ mobileOverwrite === '-1' ) { $ this -> Controller -> getRequest ( ) -> getSession ( ) -> delete ( 'User.mobile' ) ; } else { $ wantsMobile = ( bool ) $ mobileOverwrite ; $ this -> Controller -> getRequest ( ) -> getSession ( ) -> write ( 'User.mobile' , ( int ) $ wantsMobile ) ; } } $ this -> isMobile ( ) ; if ( ! $ this -> _config [ 'auto' ] ) { return ; } $ this -> setMobile ( ) ; }
Main auto-detection logic including session based storage to avoid
multiple lookups.

Uses "mobile" query string to overwrite the auto-detection.
-1 clears the fixation
1 forces mobile
0 forces no-mobile

@return void
Main auto - detection logic including session based storage to avoid multiple lookups .