private function Manifest::getCleanValues in Progressive Web App 8
Same name and namespace in other branches
- 2.x src/Manifest.php \Drupal\pwa\Manifest::getCleanValues()
Checks the values in config and add default value if necessary.
Return value
array Values from the configuration.
1 call to Manifest::getCleanValues()
- Manifest::getOutput in src/
Manifest.php - Build the manifest json string based on the configuration.
File
- src/
Manifest.php, line 117
Class
- Manifest
- Manifest JSON building service.
Namespace
Drupal\pwaCode
private function getCleanValues() {
// Set defaults.
$lang = $this->languageManager
->getDefaultLanguage();
$site_name = $this->configFactory
->get('system.site')
->get('name');
$path = \Drupal::request()
->getSchemeAndHttpHost() . '/' . drupal_get_path('module', 'pwa');
$output = [
'site_name' => $site_name,
'short_name' => $site_name,
'background_color' => '#ffffff',
'theme_color' => '#ffffff',
'display' => 'standalone',
'image' => $path . '/assets/druplicon-512.png',
'image_small' => $path . '/assets/druplicon-192.png',
'image_very_small' => $path . '/assets/druplicon-144.png',
];
$config = $this->configFactory
->get('pwa.config');
$config_data = $config
->get();
foreach ($config_data as $key => $value) {
if ($value !== '') {
$output[$key] = $value;
}
}
// Image from theme.
if ($config
->get('default_image')) {
$image = theme_get_setting('logo.path');
$output['image'] = $image;
$output['image_small'] = $image;
$output['image_very_small'] = $image;
}
return $output;
}