Commit 629f4e0f authored by alexpott's avatar alexpott
Browse files

Issue #2354491 by olli, dawehner | penyaskito: Fixed Edit new user list view...

Issue #2354491 by olli, dawehner | penyaskito: Fixed Edit new user list view throws exception on saving.
parent c93819cd
...@@ -191,6 +191,15 @@ views_field_bulk_form: ...@@ -191,6 +191,15 @@ views_field_bulk_form:
action_title: action_title:
type: label type: label
label: 'Action title' 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. # Array of routes with route_name and route_params keys.
route: route:
......
...@@ -147,16 +147,6 @@ views.field.node_link_edit: ...@@ -147,16 +147,6 @@ views.field.node_link_edit:
views.field.node_bulk_form: views.field.node_bulk_form:
type: views_field_bulk_form type: views_field_bulk_form
label: 'Node bulk form' label: 'Node bulk form'
mapping:
include_exclude:
type: string
label: 'Available actions'
selected_actions:
type: sequence
label: 'Available actions'
sequence:
- type: string
label: 'Action'
views.field.node_path: views.field.node_path:
type: views_field type: views_field
......
...@@ -127,7 +127,7 @@ public function validateOptionsForm(&$form, FormStateInterface $form_state) { ...@@ -127,7 +127,7 @@ public function validateOptionsForm(&$form, FormStateInterface $form_state) {
parent::validateOptionsForm($form, $form_state); parent::validateOptionsForm($form, $form_state);
$selected_actions = $form_state->getValue(array('options', 'selected_actions')); $selected_actions = $form_state->getValue(array('options', 'selected_actions'));
$form_state->getValue(array('options', 'selected_actions'), array_filter($selected_actions)); $form_state->setValue(array('options', 'selected_actions'), array_values(array_filter($selected_actions)));
} }
/** /**
......
...@@ -13,10 +13,17 @@ ...@@ -13,10 +13,17 @@
* Tests a user bulk form. * Tests a user bulk form.
* *
* @group user * @group user
* @see \Drupal\user\Plugin\views\field\BulkForm * @see \Drupal\user\Plugin\views\field\UserBulkForm
*/ */
class BulkFormTest extends UserTestBase { class BulkFormTest extends UserTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('views_ui');
/** /**
* Views used by this test. * Views used by this test.
* *
...@@ -92,6 +99,23 @@ public function testBulkForm() { ...@@ -92,6 +99,23 @@ public function testBulkForm() {
$this->drupalPostForm(NULL, $edit, t('Apply')); $this->drupalPostForm(NULL, $edit, t('Apply'));
$anonymous_account = user_load(0); $anonymous_account = user_load(0);
$this->assertTrue($anonymous_account->isBlocked(), 'Ensure the anonymous user got blocked.'); $this->assertTrue($anonymous_account->isBlocked(), 'Ensure the anonymous user got blocked.');
// Test the list of available actions with a value that contains a dot.
$this->drupalLogin($this->drupalCreateUser(array('administer permissions', 'administer views')));
$action_id = 'user_add_role_action.' . $role;
$edit = [
'options[include_exclude]' => 'exclude',
"options[selected_actions][$action_id]" => $action_id,
];
$this->drupalPostForm('admin/structure/views/nojs/handler/test_user_bulk_form/default/field/user_bulk_form', $edit, t('Apply'));
$this->drupalPostForm(NULL, [], t('Save'));
$this->drupalGet('test-user-bulk-form');
$this->assertNoOption('edit-action', $action_id);
$edit['options[include_exclude]'] = 'include';
$this->drupalPostForm('admin/structure/views/nojs/handler/test_user_bulk_form/default/field/user_bulk_form', $edit, t('Apply'));
$this->drupalPostForm(NULL, [], t('Save'));
$this->drupalGet('test-user-bulk-form');
$this->assertOption('edit-action', $action_id);
} }
} }
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