public static function Blazy::configSchemaInfoAlter in Blazy 8
Same name and namespace in other branches
- 8.2 src/Blazy.php \Drupal\blazy\Blazy::configSchemaInfoAlter()
Implements hook_config_schema_info_alter().
1 call to Blazy::configSchemaInfoAlter()
- blazy_config_schema_info_alter in ./
blazy.module - Implements hook_config_schema_info_alter().
File
- src/
Blazy.php, line 454
Class
- Blazy
- Implements BlazyInterface.
Namespace
Drupal\blazyCode
public static function configSchemaInfoAlter(array &$definitions, $formatter = 'blazy_base', $settings = []) {
if (isset($definitions[$formatter])) {
$mappings =& $definitions[$formatter]['mapping'];
$settings = $settings ?: BlazyDefault::extendedSettings() + BlazyDefault::gridSettings();
foreach ($settings as $key => $value) {
// Seems double is ignored, and causes a missing schema, unlike float.
$type = gettype($value);
$type = $type == 'double' ? 'float' : $type;
$mappings[$key]['type'] = $key == 'breakpoints' ? 'mapping' : (is_array($value) ? 'sequence' : $type);
if (!is_array($value)) {
$mappings[$key]['label'] = Unicode::ucfirst(str_replace('_', ' ', $key));
}
}
if (isset($mappings['breakpoints'])) {
foreach (BlazyDefault::getConstantBreakpoints() as $breakpoint) {
$mappings['breakpoints']['mapping'][$breakpoint]['type'] = 'mapping';
foreach ([
'breakpoint',
'width',
'image_style',
] as $item) {
$mappings['breakpoints']['mapping'][$breakpoint]['mapping'][$item]['type'] = 'string';
$mappings['breakpoints']['mapping'][$breakpoint]['mapping'][$item]['label'] = Unicode::ucfirst(str_replace('_', ' ', $item));
}
}
}
// @todo: Drop non-UI stuffs.
foreach ([
'dimension',
'display',
'item_id',
] as $key) {
$mappings[$key]['type'] = 'string';
}
}
}