Skip to content
Snippets Groups Projects
Commit 66aae360 authored by Christian Fritsch's avatar Christian Fritsch Committed by Christian Fritsch
Browse files

Issue #2940857 by chr.fritsch, kfritsche: Views integration broken

parent 8588d57f
No related branches found
No related tags found
No related merge requests found
......@@ -80,3 +80,30 @@ function content_lock_update_8001(&$sandbox) {
drupal_uninstall_schema('content_lock');
drupal_install_schema('content_lock');
}
/**
* Use boolean instead of content_lock_field views field plugin.
*/
function content_lock_update_8002(&$sandbox) {
$config_factory = \Drupal::configFactory();
// Find all views configs.
foreach ($config_factory->listAll('views.view.') as $view_config_name) {
$view = $config_factory->getEditable($view_config_name);
// Go through each display on each view.
$displays = $view->get('display');
foreach ($displays as $display_name => $display) {
// Go through all the entity fields on each display and find ones
// currently using 'date' as the plugin.
if (!empty($display['display_options']['fields'])) {
foreach ($display['display_options']['fields'] as $field_name => $field) {
if ($field['field'] === 'is_locked' && $field['plugin_id'] === 'content_lock_field') {
// Update the field to use the new plugin.
$base = "display.$display_name.display_options.fields.$field_name";
$view->set($base . '.plugin_id', 'boolean');
}
}
}
}
$view->save(TRUE);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment