Commit 5fcb8501 authored by arknoll's avatar arknoll Committed by tlyngej

Issue #2863446 by tlyngej, arknoll: More advanced wildcards

parent 90408aa9
......@@ -39,7 +39,7 @@ class Settings extends ConfigFormBase {
'#type' => 'textarea',
'#rows' => 25,
'#title' => $this->t('Configuration entity names to ignore'),
'#description' => $this->t('One configuration name per line.<br />Examples: <ul><li>user.settings</li><li>views.settings</li><li>contact.settings</li><li>webform.webform.* (will ignore all config entities that starts with <em>webform.webform</em>)</li><li>* (will ignore everything)</li><li>~webform.webform.contact (will force import for this configuration, even if ignored by a wildcard)</li></ul>'),
'#description' => $this->t('One configuration name per line.<br />Examples: <ul><li>user.settings</li><li>views.settings</li><li>contact.settings</li><li>webform.webform.* (will ignore all config entities that starts with <em>webform.webform</em>)</li><li>*.contact_message.custom_contact_form.* (will ignore all config entities that starts with <em>.contact_message.custom_contact_form.</em> like fields attached to a custom contact form)</li><li>* (will ignore everything)</li><li>~webform.webform.contact (will force import for this configuration, even if ignored by a wildcard)</li></ul>'),
'#default_value' => implode(PHP_EOL, $config_ignore_settings->get('ignored_config_entities')),
'#size' => 60,
];
......
......@@ -88,22 +88,7 @@ class IgnoreFilter extends ConfigFilterBase implements ContainerFactoryPluginInt
}
foreach ($this->configuration['ignored'] as $config_ignore_setting) {
// Check if the last character in the string is an asterisk.
// If so, it means that it is a wildcard.
if (Unicode::substr($config_ignore_setting, -1) == static::INCLUDE_SUFFIX) {
// Remove the asterisk character from the end of the string.
$config_ignore_setting = rtrim($config_ignore_setting, static::INCLUDE_SUFFIX);
// Test if the start of the config, we are checking, are matching
// the $config_ignore_setting string. If it is a match, mark
// that config name to be ignored.
if (Unicode::substr($config_name, 0, strlen($config_ignore_setting)) == $config_ignore_setting) {
return TRUE;
}
}
// If string does not contain an asterisk in the end, just compare
// the two strings, and if they match, mark that config name to be
// ignored.
elseif ($config_name == $config_ignore_setting) {
if (fnmatch($config_ignore_setting, $config_name)) {
return TRUE;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment