• Модуль: mobileapp
  • Путь к файлу: ~/bitrix/modules/mobileapp/lib/mobile.php
  • Класс: BitrixMobileAppMobile
  • Вызов: Mobile::getViewPort
public function getViewPort($width = "")
{

	if ($width == "")
	{
		$width = $this->getDevicewidth();
	}

	if ($this->largeScreenSupport == true)
	{
		//we need to change densitydpi for large screens
		if ($this->getDevice() == "iPad")
		{
			//ipad large screen setting
			return $this->getIPadViewPort();

		}
		elseif (($this->getScreenCategory() == "LARGE" || $this->getScreenCategory() == "XLARGE"))
		{
			//android large screen setting
			return $this->getLargeScreenViewPort();
		}
	}

	$viewPortMeta = "";
	if ($this->getIniscale())
	{
		$contentAttributes[] = "initial-scale=" . $this->getIniscale();
	}
	if ($this->getMaxscale())
	{
		$contentAttributes[] = "maximum-scale=" . $this->getMaxscale();
	}
	if ($this->getMinscale())
	{
		$contentAttributes[] = "minimum-scale=" . $this->getMinscale();
	}


	if ($this->getWidth())
	{
		$contentAttributes[] = "width=" . $this->getWidth();
	}
	elseif ($this->getIniscale())
	{
		$contentAttributes[] = "width=" . ($width / $this->getIniscale());
	}

	if (!$this->getWidth())
	{
		$contentAttributes[] = "width=device-width";
	}


	$contentAttributes[] = "user-scalable=" . $this->getUserScalable();
	$contentAttributes[] = "viewport-fit=cover";

	return str_replace("#content_value#", implode(", ", $contentAttributes), $viewPortMeta);
}