public function BlazyAdminFormatterBase::getExcludedSettingsSummary in Blazy 7
Same name and namespace in other branches
- 8.2 src/Form/BlazyAdminFormatterBase.php \Drupal\blazy\Form\BlazyAdminFormatterBase::getExcludedSettingsSummary()
- 8 src/Form/BlazyAdminFormatterBase.php \Drupal\blazy\Form\BlazyAdminFormatterBase::getExcludedSettingsSummary()
Exclude the field formatter settings summary as required.
1 call to BlazyAdminFormatterBase::getExcludedSettingsSummary()
- BlazyAdminFormatterBase::getSettingsSummary in src/
Form/ BlazyAdminFormatterBase.php - Return the field formatter settings summary.
File
- src/
Form/ BlazyAdminFormatterBase.php, line 140
Class
- BlazyAdminFormatterBase
- A base for field formatter admin to have re-usable methods in one place.
Namespace
Drupal\blazy\FormCode
public function getExcludedSettingsSummary(array &$definition = []) {
$settings =& $definition['settings'];
$excludes = empty($definition['excludes']) ? [] : $definition['excludes'];
$plugin_id = isset($definition['plugin_id']) ? $definition['plugin_id'] : '';
$blazy = $plugin_id && strpos($plugin_id, 'blazy') !== FALSE;
$image_styles = image_style_options(TRUE);
unset($image_styles['']);
$excludes['current_view_mode'] = TRUE;
if ($blazy) {
$excludes['optionset'] = TRUE;
}
if (!empty($settings['responsive_image_style'])) {
foreach ([
'ratio',
'breakpoints',
'background',
'sizes',
] as $key) {
$excludes[$key] = TRUE;
}
}
if (empty($settings['grid'])) {
foreach ([
'grid',
'grid_medium',
'grid_small',
'visible_items',
] as $key) {
$excludes[$key] = TRUE;
}
}
// Remove exluded settings.
foreach ($excludes as $key => $value) {
if (isset($settings[$key])) {
unset($settings[$key]);
}
}
foreach ($settings as $key => $setting) {
if ($key == 'style' || $key == 'responsive_image_style' || empty($settings[$key])) {
continue;
}
if (strpos($key, 'style') !== FALSE && isset($image_styles[$settings[$key]])) {
$settings[$key] = $image_styles[$settings[$key]];
}
}
}