Verified Commit 458f2411 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3318108 by Lendude, rreedy: Views Roles Contextual Filters Multiple Option not saving

(cherry picked from commit 6124da74)
(cherry picked from commit db7e48bf)
parent 8b54960b
Loading
Loading
Loading
Loading
+25 −1
Original line number Diff line number Diff line
@@ -17,6 +17,11 @@ class RolesRidArgumentTest extends UserTestBase {
   */
  public static $testViews = ['test_user_roles_rid'];

  /**
   * {@inheritdoc}
   */
  protected static $modules = ['views_ui'];

  /**
   * {@inheritdoc}
   */
@@ -27,12 +32,31 @@ class RolesRidArgumentTest extends UserTestBase {
   */
  public function testArgumentTitle() {
    $role_id = $this->createRole([], 'markup_role_name', '<em>Role name with markup</em>');
    $user = $this->createUser();
    $this->createRole([], 'second_role_name', 'Second role name');
    $user = $this->createUser([], 'User with role one');
    $user->addRole($role_id);
    $user->save();
    $second_user = $this->createUser([], 'User with role two');
    $second_user->addRole('second_role_name');
    $second_user->save();

    $this->drupalGet('/user_roles_rid_test/markup_role_name');
    $this->assertSession()->assertEscaped('<em>Role name with markup</em>');

    $views_user = $this->drupalCreateUser(['administer views']);
    $this->drupalLogin($views_user);

    // Change the View to allow multiple values for the roles.
    $edit = [
      'options[break_phrase]' => TRUE,
    ];
    $this->drupalGet('admin/structure/views/nojs/handler/test_user_roles_rid/page_1/argument/roles_target_id');
    $this->submitForm($edit, 'Apply');
    $this->submitForm([], 'Save');

    $this->drupalGet('/user_roles_rid_test/markup_role_name+second_role_name');
    $this->assertSession()->pageTextContains('User with role one');
    $this->assertSession()->pageTextContains('User with role two');
  }

}
+1 −3
Original line number Diff line number Diff line
@@ -40,9 +40,7 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o
  protected function defineOptions() {
    $options = parent::defineOptions();

    if (!empty($this->definition['numeric'])) {
    $options['break_phrase'] = ['default' => FALSE];
    }

    $options['add_table'] = ['default' => FALSE];
    $options['require_value'] = ['default' => FALSE];