Problem/Motivation

Steps to reproduce:

  1. Edit new users view
  2. Add field, filter by user, select all of them
  3. Click save
Drupal\Core\Config\ConfigValueException: user_add_role_action.administrator key contains a dot which is not supported. in Drupal\Core\Config\ConfigBase->validateKeys() (line 217 of core/lib/Drupal/Core/Config/ConfigBase.php).
Drupal\Core\Config\ConfigBase->validateKeys([Array])
Drupal\Core\Config\ConfigBase->validateKeys([Array])
Drupal\Core\Config\ConfigBase->validateKeys([Array])
Drupal\Core\Config\ConfigBase->validateKeys([Array])
Drupal\Core\Config\ConfigBase->validateKeys([Array])
Drupal\Core\Config\ConfigBase->validateKeys([Array])
Drupal\Core\Config\ConfigBase->set(display, [Array])
Drupal\Core\Config\Config->set(display, [Array])
Drupal\Core\Config\Entity\ConfigEntityStorage->doSave(who_s_new, Drupal\views\Entity\View)
Drupal\Core\Entity\EntityStorageBase->save(Drupal\views\Entity\View)
Drupal\Core\Config\Entity\ConfigEntityStorage->save(Drupal\views\Entity\View)
Drupal\Core\Entity\Entity->save()
Drupal\views_ui\ViewUI->save()
Drupal\views_ui\ViewEditForm->save([Array], Drupal\Core\Form\FormState)
call_user_func_array([Array], [Array])
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers([Array], Drupal\Core\Form\FormState)
Drupal\Core\Form\FormSubmitter->doSubmitForm([Array], Drupal\Core\Form\FormState)
Drupal\Core\Form\FormBuilder->processForm(view_edit_form, [Array], Drupal\Core\Form\FormState)
Drupal\Core\Form\FormBuilder->buildForm(Drupal\views_ui\ViewEditForm, Drupal\Core\Form\FormState)
Drupal\Core\Entity\EntityFormBuilder->getForm(Drupal\views_ui\ViewUI, edit, [Array])
Drupal\views_ui\Controller\ViewsUIController->edit(Drupal\views_ui\ViewUI, block_1)
call_user_func_array([Array], [Array])
Drupal\Core\Controller\HtmlPageController->getContentResult(Symfony\Component\HttpFoundation\Request, \Drupal\views_ui\Controller\ViewsUIController::edit)
Drupal\Core\Controller\HtmlPageController->content(Symfony\Component\HttpFoundation\Request, \Drupal\views_ui\Controller\ViewsUIController::edit)
call_user_func_array([Array], [Array])
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Symfony\Component\HttpFoundation\Request, 1)
Symfony\Component\HttpKernel\HttpKernel->handle(Symfony\Component\HttpFoundation\Request, 1, TRUE)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Symfony\Component\HttpFoundation\Request, 1, TRUE)
Drupal\Core\StackMiddleware\PageCache->handle(Symfony\Component\HttpFoundation\Request, 1, TRUE)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Symfony\Component\HttpFoundation\Request, 1, TRUE)
Stack\StackedHttpKernel->handle(Symfony\Component\HttpFoundation\Request, 1, TRUE)
Drupal\Core\DrupalKernel->handle(Symfony\Component\HttpFoundation\Request)

Proposed resolution

Remaining tasks

User interface changes

API changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

penyaskito’s picture

Priority: Normal » Critical

If I'm right, throwing an exception to the user face makes an issue critical during beta period.
I used the views component, but not sure if it is config instead.

penyaskito’s picture

The culprit is "User: Bulk update".

penyaskito’s picture

What we are intending to save is:

        selected_actions:
            user_add_role_action.administrator: 0
            user_block_user_action: 0
            user_cancel_user_action: 0
            user_remove_role_action.administrator: 0
            user_unblock_user_action: 0

Actions ids are in the form action_name.rid, but the . is not allowed as keys, which is what views is trying to do.

dawehner’s picture

FileSize
835 bytes

Something along this is probably the simplest solution.

penyaskito’s picture

This is meant to be the action id, so is the filename of the yml file too. ':' is not allowed in a file name in Windows.

dawehner’s picture

This is meant to be the action id, so is the filename of the yml file too. ':' is not allowed in a file name in Windows.

What kind of other separator could we use? Two underscores maybe?

penyaskito’s picture

That was my first thought, but that would be a convention we don't have any way to enforce afaik. I will ping alexpott for getting his view on this one.

penyaskito’s picture

Discussed with alexpott and dawehner on IRC:

12:05 < alexpott> penyaskito: we should be just saving an array of actions not an array keyed by action id
12:06 < alexpott> penyaskito: this is a good thing since this prevents the view from changing when new actions are added

olli’s picture

Status: Active » Needs review
Issue tags: +VDC
FileSize
1.85 KB
2.58 KB

Something like this?

The last submitted patch, 9: 2354491-test_only.patch, failed testing.

dawehner’s picture

+++ b/core/modules/system/src/Plugin/views/field/BulkForm.php
@@ -127,7 +127,7 @@ public function validateOptionsForm(&$form, FormStateInterface $form_state) {
     $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)));
   }

I guess you would have to adapt the config schema here as well? Maybe though we just don't have any config schema for it yet, you never know :)

olli’s picture

FileSize
3.88 KB
1.3 KB

We have some schema in core, action, node and user:
core/config/schema/core.data_types.schema.yml

views_field_bulk_form:
  type: views_field
  label: 'Bulk operation'
  mapping:
    action_title:
      type: label
      label: 'Action title'

core/modules/action/config/schema/action.views.schema.yml

views.field.bulk_form:
  type: views_field_bulk_form
  label: 'Bulk form'

core/modules/node/config/schema/node.views.schema.yml

views.field.node_bulk_form:
  type: views_field_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'

core/modules/user/config/schema/user.views.schema.yml

views.field.user_bulk_form:
  type: views_field_bulk_form
  label: 'User operations bulk form'

Not sure what to do with these here, but moved that mapping from node to core.

Why is the bulk_form implementation in system module, tests, schema and views_form_substitutions in action module, views_data in views module? These would be easier to find if we could move them to views in a follow-up for example.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Why is the bulk_form implementation in system module, tests, schema and views_form_substitutions in action module, views_data in views module? These would be easier to find if we could move them to views in a follow-up for example.

It is indeed kind of a mess at the moment, and there was probably "a reason" for it. I think we thought that this is an UI for actions, which is exactly what is part of action module ... but yeah feel free to change that in the future.

The last submitted patch, 4: 2354491.patch, failed testing.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

This issue addresses a critical bug and is allowed per https://www.drupal.org/core/beta-changes. Committed 629f4e0 and pushed to 8.0.x. Thanks!

  • alexpott committed 629f4e0 on 8.0.x
    Issue #2354491 by olli, dawehner | penyaskito: Fixed Edit new user list...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.