private function ConfigurationForm::getDisplayValue in Progressive Web App 8
Same name and namespace in other branches
- 2.x src/Form/ConfigurationForm.php \Drupal\pwa\Form\ConfigurationForm::getDisplayValue()
function converts an id to a display string or a string to an id
Parameters
$value:
boolean $needId:
Return value
int|string
2 calls to ConfigurationForm::getDisplayValue()
- ConfigurationForm::buildForm in src/
Form/ ConfigurationForm.php - Form constructor.
- ConfigurationForm::submitForm in src/
Form/ ConfigurationForm.php - Form submission handler.
File
- src/
Form/ ConfigurationForm.php, line 281
Class
- ConfigurationForm
- Class ConfigurationForm.
Namespace
Drupal\pwa\FormCode
private function getDisplayValue($value, $needId) {
if ($needId) {
$id = 1;
switch ($value) {
case 'standalone':
$id = 2;
break;
case 'minimal-ui':
$id = 3;
break;
case 'browser':
$id = 4;
break;
}
return $id;
}
else {
$display = '';
switch ($value) {
case 1:
$display = 'fullscreen';
break;
case 2:
$display = 'standalone';
break;
case 3:
$display = 'minimal-ui';
break;
case 4:
$display = 'browser';
break;
}
}
return $display;
}