public static function Slick::typecast in Slick Carousel 7.3
Returns the typecast values.
Parameters
array $settings: An array of Optionset settings.
Overrides SlickBase::typecast
1 call to Slick::typecast()
- SlickForm::edit_form_submit in slick_ui/
src/ Form/ SlickForm.php - Handle the submission of the edit form.
File
- src/
Entity/ Slick.php, line 72
Class
- Slick
- Defines the Slick configuration entity.
Namespace
Drupal\slick\EntityCode
public static function typecast(array &$settings = []) {
if (empty($settings)) {
return;
}
$defaults = self::defaultSettings();
foreach ($defaults as $name => $value) {
if (isset($settings[$name])) {
// Seems double is ignored, and causes a missing schema, unlike float.
$type = gettype($defaults[$name]);
$type = $type == 'double' ? 'float' : $type;
// Change float to integer if value is no longer float.
if ($name == 'edgeFriction') {
$type = $settings[$name] == '1' ? 'integer' : 'float';
}
settype($settings[$name], $type);
}
}
}