private static function Features::fixLaggingFieldGroup in Hook Update Deploy Tools 8
Same name and namespace in other branches
- 7 src/Features.php \HookUpdateDeployTools\Features::fixLaggingFieldGroup()
FieldGroup is cached and shows as overridden immeditately after revert.
Calling this method fixes this lagging state by ignoring it, IF it is the only component that is showing as reverted.
Parameters
array $states: The $states array by ref (as created by features_get_component_states).
1 call to Features::fixLaggingFieldGroup()
- Features::isOverridden in src/
Features.php - Check to see if a feature component is overridden.
File
- src/
Features.php, line 233
Class
- Features
- Public method for reverting Features only if needed.
Namespace
HookUpdateDeployToolsCode
private static function fixLaggingFieldGroup(&$states) {
if (is_array($states)) {
// Count the number of components out of default.
foreach ($states as $featurename => $components) {
$overridden_count = 0;
foreach ($components as $component) {
if ($component !== FEATURES_DEFAULT) {
$overridden_count++;
}
}
if ($overridden_count == 1 && !empty($states[$featurename]['field_group'])) {
// $states['field_group'] is the only one out of default, ignore it.
$states[$featurename]['field_group'] = 0;
}
}
}
}