Problem/Motivation

Followup for #2049573: Move most or all of the ActionBulkForm class to BulkFormBase where all BulkForms were merged into a single base class. Some of the logic however is specific for Views and should be moved to the appropriate module.

Proposed resolution

Move the logic specific for Views to the Views module.

Remaining tasks

  • Write a patch
  • Review

User interface changes

None

API changes

None

Original report by @username

BulkFormBase is currently living in system module (it's the only views plugin in system module) and it would be better inside Views itself.

This means \Drupal\system\Plugin\views\field\BulkFormBase should be \Drupal\views\Plugin\views\field\BulkFormBase

Blocked by #2049573: Move most or all of the ActionBulkForm class to BulkFormBase

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Task because it is a general cleanup. No new logic is added. No bugs are resolved.
Issue priority Normal because it is a code refactoring
Unfrozen changes Unfrozen because it only moves code from one to another
Prioritized changes This is not a prioritized change for the beta phase.
Disruption Not disruptive

Comments

pcambra’s picture

Issue summary: View changes
Status: Postponed » Active
Issue tags: +VDC

#2049573: Move most or all of the ActionBulkForm class to BulkFormBase is in now and I guess this is still wanted, now is not BulkFormBase but BulkForm

pcambra’s picture

Status: Active » Needs review
StatusFileSize
new21.66 KB

Here we go

dawehner’s picture

Have you tried to use https://drupal.org/documentation/git/configure which lets you to provide move only patches?

pcambra’s picture

StatusFileSize
new1.81 KB

Thanks for the tip @dawehner!

Here's a new patch

Status: Needs review » Needs work

The last submitted patch, 4: 2058869-vdc-4.patch, failed testing.

pcambra’s picture

StatusFileSize
new1.81 KB

What were the chances of the file changing place this morning uh? :)

pcambra’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 6: 2058869-vdc-6.patch, failed testing.

pcambra’s picture

For some reason git is getting the rename with the configuration linked in #3

#	renamed:    core/modules/system/lib/Drupal/system/Plugin/views/field/BulkForm.php -> core/modules/views/lib/Drupal/views/Plugin/views/field/BulkForm.php

But when I do a diff is trying to diff the moved file with itself.

diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/field/BulkForm.php b/core/modules/views/lib/Drupal/views/Plugin/views/field/BulkForm.php

pcambra’s picture

Status: Needs work » Needs review
StatusFileSize
new1.99 KB

Ok, figured out how to do the right diff.

I had to create a branch and commit the changes, and then used -C option:

git diff 8.x -C > 2058869-vdc-10.patch

Maybe is worth documenting it?

alansaviolobo’s picture

StatusFileSize
new21.63 KB

reroll

dawehner’s picture

It would be great if you could use a git configuration which keeps track of moves, so the patch
size would be reduced quite a lot. (see https://www.drupal.org/documentation/git/configure "Optimize diffs for renamed and copied files").

idebr’s picture

StatusFileSize
new1.81 KB

Rerolled again.

idebr’s picture

Assigned: pcambra » Unassigned
dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Awesome!

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs issue summary update

This issue is a normal task so we need to outline how it fits within the allowable Drupal 8 beta criteria. Can someone add Drupal 8 beta phase evaluation template to the issue summary.

idebr’s picture

Issue summary: View changes
Status: Needs work » Reviewed & tested by the community

Added an issue summary and a beta evaluation. I set the issue back to RTBC, since the patch has not changed. Please let me know if this was an incorrect assumption.

idebr’s picture

Removed tag 'Needs issue summary update'

alexpott’s picture

Status: Reviewed & tested by the community » Needs review

I'm not sure there is any value in breaking all contrib modules that extend Drupal\system\Plugin\views\field\BulkForm; this plugin is only used if views is installed. I don't think the benefits outweigh the disruption in this case.

Setting back to "needs review" to give people a chance to disagree.

dawehner’s picture

Its easier to find in views though, you simply don't expect it to be in system module.

olli’s picture

I agree with #20. Should we also move tests, schema and hook_views_form_substitutions from action module, and views_field_bulk_form from core.data_types.schema.yml to views here?

alexpott’s picture

@olli afaics action_views_form_substitutions() is not used or tested anywhere. But the answer to your question is yes we should get everything together in the right place.

olli’s picture

StatusFileSize
new7.2 KB
new5.39 KB

Removed action_views_form_substitutions() and moved bulk form test and schema to views.

olli’s picture

StatusFileSize
new6.37 KB
new504 bytes

reroll

dawehner’s picture

+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-/**
- * @file
- * Provides views runtime hooks for action.module.
- */
-
-use Drupal\Component\Utility\String;
-
-/**
- * Implements hook_views_form_substitutions().
- */
-function action_views_form_substitutions() {
-  // Views String::checkPlain()s the column label, so we need to match that.
-  $select_all_placeholder = String::checkPlain('<!--action-bulk-form-select-all-->');
-  $select_all = array(
-    '#type' => 'checkbox',
-    '#default_value' => FALSE,
-    '#attributes' => array('class' => array('action-table-select-all')),
-  );
-  return array(
-    $select_all_placeholder => drupal_render($select_all),
-  );
-}
diff --git a/core/modules/action/tests/action_bulk_test/action_bulk_test.info.yml b/core/modules/action/tests/action_bulk_test/action_bulk_test.info.yml

I'm curious, what happened with that bit of code? Can you explain why it can be removed?

olli’s picture

Thanks for the review, @dawehner. I couldn't find any other usages of that placeholder or the class. I also don't see why that code was added in #1828410: Provide a bulk_form element for actions. Maybe that part of vbo was not fully included?

dawehner’s picture

Thanks for @bojanz, this is about the select all box, which we afaik want, right? Isn't the all checkbox provided by that?

olli’s picture

That's the "select all on all pages", right? And we have only simple select-all checkbox "select all on this page".

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

dawehner’s picture

Status: Needs review » Needs work

@olli I guess so, but well, removing that should be its own scoped issue, IMHO.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

lendude’s picture

Status: Needs work » Closed (outdated)

This was fixed by #2916451: Move everything related to Bulk Form to Views module. Never found this issue when searching for existing issues before I filed that one :(