Commit c2035753 authored by catch's avatar catch

Issue #2916451 by Lendude, xjm: Move everything related to Bulk Form to Views module

parent b912d774
......@@ -213,23 +213,6 @@ theme_settings:
sequence:
type: theme_settings.third_party.[%key]
views_field_bulk_form:
type: views_field
label: 'Bulk operation'
mapping:
action_title:
type: label
label: 'Action title'
include_exclude:
type: string
label: 'Available actions'
selected_actions:
type: sequence
label: 'Available actions'
sequence:
type: string
label: 'Action'
# Array of routes with route_name and route_params keys.
route:
type: mapping
......
......@@ -2,7 +2,7 @@
namespace Drupal\comment\Plugin\views\field;
use Drupal\system\Plugin\views\field\BulkForm;
use Drupal\views\Plugin\views\field\BulkForm;
/**
* Defines a comment operations bulk form element.
......
......@@ -2,7 +2,7 @@
namespace Drupal\node\Plugin\views\field;
use Drupal\system\Plugin\views\field\BulkForm;
use Drupal\views\Plugin\views\field\BulkForm;
/**
* Defines a node operations bulk form element.
......
......@@ -3,8 +3,8 @@
namespace Drupal\user\Plugin\views\field;
use Drupal\Core\Form\FormStateInterface;
use Drupal\system\Plugin\views\field\BulkForm;
use Drupal\user\UserInterface;
use Drupal\views\Plugin\views\field\BulkForm;
/**
* Defines a user operations bulk form element.
......
......@@ -820,3 +820,20 @@ views_cache:
views_display_extender:
type: mapping
label: 'Display extender settings'
views_field_bulk_form:
type: views_field
label: 'Bulk operation'
mapping:
action_title:
type: label
label: 'Action title'
include_exclude:
type: string
label: 'Available actions'
selected_actions:
type: sequence
label: 'Available actions'
sequence:
type: string
label: 'Action'
This diff is collapsed.
<?php
/**
* @file
* Test fixture.
*/
use Drupal\Core\Database\Database;
use Drupal\Core\Serialization\Yaml;
$connection = Database::getConnection();
$connection->insert('config')
->fields([
'collection' => '',
'name' => 'views.view.legacy_bulk_form',
'data' => serialize(Yaml::decode(file_get_contents(__DIR__ . '/views.view.legacy_bulk_form.yml'))),
])
->execute();
uuid: 67e001ab-bf26-4317-98a0-9ef7c8e6773a
langcode: en
status: true
dependencies:
module:
- node
- system
- user
id: legacy_bulk_form
label: 'legacy bulk form'
module: views
description: ''
tag: ''
base_table: node_field_data
base_field: nid
core: 8.x
display:
default:
display_plugin: default
id: default
display_title: Master
position: 0
display_options:
access:
type: perm
options:
perm: 'access content'
cache:
type: tag
options: { }
query:
type: views_query
options:
disable_sql_rewrite: false
distinct: false
replica: false
query_comment: ''
query_tags: { }
exposed_form:
type: basic
options:
submit_button: Apply
reset_button: false
reset_button_label: Reset
exposed_sorts_label: 'Sort by'
expose_sort_order: true
sort_asc_label: Asc
sort_desc_label: Desc
pager:
type: mini
options:
items_per_page: 10
offset: 0
id: 0
total_pages: null
expose:
items_per_page: false
items_per_page_label: 'Items per page'
items_per_page_options: '5, 10, 25, 50'
items_per_page_options_all: false
items_per_page_options_all_label: '- All -'
offset: false
offset_label: Offset
tags:
previous: ‹‹
next: ››
style:
type: default
options:
grouping: { }
row_class: ''
default_row_class: true
uses_fields: false
row:
type: fields
options:
inline: { }
separator: ''
hide_empty: false
default_field_elements: true
fields:
nid:
id: nid
table: node_field_data
field: nid
relationship: none
group_type: group
admin_label: ''
label: ''
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: false
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: value
type: number_integer
settings:
thousand_separator: ''
prefix_suffix: true
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
entity_type: node
entity_field: nid
plugin_id: field
node_bulk_form:
id: node_bulk_form
table: node
field: node_bulk_form
relationship: none
group_type: group
admin_label: ''
label: ''
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: false
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
action_title: Action
include_exclude: exclude
selected_actions: { }
entity_type: node
plugin_id: bulk_form
filters:
status:
value: '1'
table: node_field_data
field: status
plugin_id: boolean
entity_type: node
entity_field: status
id: status
expose:
operator: ''
group: 1
sorts:
created:
id: created
table: node_field_data
field: created
order: DESC
entity_type: node
entity_field: created
plugin_id: date
relationship: none
group_type: group
admin_label: ''
exposed: false
expose:
label: ''
granularity: second
header: { }
footer: { }
empty: { }
relationships: { }
arguments: { }
display_extenders: { }
cache_metadata:
max-age: 0
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url.query_args
- 'user.node_grants:view'
- user.permissions
tags: { }
<?php
namespace Drupal\Tests\views\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
use Drupal\views\Entity\View;
/**
* Tests Views image style dependencies update.
*
* @group views
*/
class LegacyBulkFormUpdateTest extends UpdatePathTestBase {
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
__DIR__ . '/../../../fixtures/update/legacy-bulk-form-update.php'
];
}
/**
* Tests the updating of dependencies for Views using the bulk_form plugin.
*/
public function testBulkFormDependencies() {
$module_dependencies = View::load('legacy_bulk_form')->getDependencies()['module'];
$this->assertTrue(in_array('system', $module_dependencies));
$this->runUpdates();
$module_dependencies = View::load('legacy_bulk_form')->getDependencies()['module'];
$this->assertFalse(in_array('system', $module_dependencies));
}
}
......@@ -256,3 +256,17 @@ function views_post_update_entity_link_url() {
}
}
}
/**
* Update dependencies for moved bulk field plugin.
*/
function views_post_update_bulk_field_moved() {
$views = View::loadMultiple();
array_walk($views, function (View $view) {
$old_dependencies = $view->getDependencies();
$new_dependencies = $view->calculateDependencies()->getDependencies();
if ($old_dependencies !== $new_dependencies) {
$view->save();
}
});
}
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