You are here

function _pwa_apple_splash_screens_meta in Progressive Web App 7.2

1 call to _pwa_apple_splash_screens_meta()
_pwa_apple_drusplash_list in includes/pwa.apple.inc
@file

File

includes/pwa.apple.inc, line 19

Code

function _pwa_apple_splash_screens_meta($manifest) {
  $metas = [];
  $devices = array_filter((array) variable_get('pwa_apple_startup-image_devices'));

  // Take the largest icon to generate the splashscreens.
  foreach (_pwa_apple_devices() as $device) {

    // Generate meta for selected devices only.
    if (!in_array($device->device, $devices)) {
      continue;
    }
    $scale = $device->scaleFactor;
    $media = [
      'width' => '(device-width: ' . $device->portrait->width / $scale . 'px)',
      'height' => '(device-height: ' . $device->portrait->height / $scale . 'px)',
      'pixel' => '(-webkit-device-pixel-ratio: ' . $scale . ')',
    ];
    foreach ([
      'landscape',
      'portrait',
    ] as $orientation) {
      if ($href = _pwa_apple_get_spalsh_screen_href((array) $device->{$orientation})) {
        $metas[$device->device . '-' . $orientation] = [
          'media' => implode(' and ', $media + [
            'orientation' => '(orientation: ' . $orientation . ')',
          ]),
          'href' => $href,
          'data-device' => $device->device,
        ];
      }
    }
  }
  return $metas;
}