protected function ConfigBit::targetConfigExpectedToHave in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 8.8
Same name and namespace in other branches
- 9.0.x src/Config/ConfigBit.php \Drupal\varbase\Config\ConfigBit::targetConfigExpectedToHave()
Check target config expected to have.
Parameters
array $config_action: The config action.
array $target_config_data: The target config data.
1 call to ConfigBit::targetConfigExpectedToHave()
- ConfigBit::expectedTargetConfig in src/
Config/ ConfigBit.php - Check expected target config.
File
- src/
Config/ ConfigBit.php, line 459
Class
- ConfigBit
- Class ConfigBit.
Namespace
Drupal\varbase\ConfigCode
protected function targetConfigExpectedToHave(array $config_action, array $target_config_data) {
$target_config_expected_to_have = TRUE;
if (isset($config_action['target_config_expected_to_have'])) {
// Computes the difference of arrays with additional index check.
// containing all the values from [target config expected to have]
// that are not present in [target config data].
// ----------------------------------------------------------------------.
// Wild card exption to have in all listed configs.
if (isset($config_action['expected_config_wild_card'])) {
$wild_card_configs = $this->configFactory
->listAll($config_action['expected_config_wild_card']);
foreach ($wild_card_configs as $wild_card_name) {
$wild_card_factory = $this->configFactory
->getEditable($wild_card_name);
$wild_card_data = $wild_card_factory
->get($config_action['target_config_path']);
$wild_card_expected_to_have_diff = DiffArray::diffAssocRecursive($config_action['target_config_expected_not_to_have'], $wild_card_data);
if (isset($wild_card_expected_to_have_diff) && count($wild_card_expected_to_have_diff) > 0) {
$target_config_expected_to_have = FALSE;
break;
}
}
}
else {
$expected_to_have_diff = DiffArray::diffAssocRecursive($config_action['target_config_expected_to_have'], $target_config_data);
if (isset($expected_to_have_diff) && count($expected_to_have_diff) > 0) {
$target_config_expected_to_have = FALSE;
}
}
}
else {
$target_config_expected_to_have = TRUE;
}
return $target_config_expected_to_have;
}