public function ViewUnpublishedInstallHelper::removeDependency in view_unpublished 8
Remove the errant view_unpublished dependency from Views.
File
- src/
ViewUnpublishedInstallHelper.php, line 65
Class
- ViewUnpublishedInstallHelper
- Class ViewUnpublishedInstallHelper.
Namespace
Drupal\view_unpublishedCode
public function removeDependency() {
$view_names = $this->configStorage
->listAll('views.view');
foreach ($view_names as $name) {
$dependencies = $this->configFactory
->get($name)
->get('dependencies.module');
if (!empty($dependencies) && array_key_exists('view_unpublished', array_flip($dependencies))) {
$dependencies = array_diff($dependencies, [
'view_unpublished',
]);
$this->configFactory
->getEditable($name)
->set('dependencies.module', $dependencies)
->save(TRUE);
}
}
}