I am developing a project where I use flags and I want to use also VBO (Views Bulk Operations). There is a problem when you create a view and try to use the field "Global: Views bulk operations". Although you can add it just fine, when you save the view a crash occurs, with the error, as stored in watchdog, "Drupal\Core\Config\ConfigValueException: flag_action:bookmark.flag key contains a dot which is not supported. in Drupal\Core\Config\ConfigBase->validateKeys() (line 211 of /var/www/html/core/lib/Drupal/Core/Config/ConfigBase.php)."
By some search I did, it seems there is a problem with views when entity ids use dots in their name ID.
You can reproduce it by doing the following:
1. Install Flag latest dev version ( 2017-Jun-09) and the Bookmark module that come with Flag
2. Install the module Views Bulk Operations (https://www.drupal.org/project/views_bulk_operations), latest dev version
3. Create a content view show fields, and beside "Title" field add the "Global: Views bulk operations" field. It doesn't matter what you select at it's config.
4. Save the view an an error should show up.
I also use latest Drupal 8.3.5
| Comment | File | Size | Author |
|---|---|---|---|
| #40 | flag-vbo-2893259-40.patch | 1.1 KB | dariogcode |
| #27 | 2893259-27.patch | 9.47 KB | benjifisher |
| #27 | interdiff-2893259-24-27.txt | 1.26 KB | benjifisher |
| #24 | 2893259-24.patch | 8.14 KB | seanb |
| #24 | interdiff-18-23.txt | 7.27 KB | seanb |
Comments
Comment #2
eswiderski commentedConfirmed I am experiencing this too.
Comment #3
joachim commentedThat sounds like a general problem with the way our actions are named.
Comment #4
Andy_D commentedJust got this same error when testing VBO and had the Flag Bookmark example module enabled. Looks a bit like https://www.drupal.org/node/2293773 this to me
Comment #5
Andy_D commentedA quick update - using `Node operations bulk form` instead of the VBO does not produce the same error so could this be related to how VBO is parsing the actions?
Comment #6
maaty388 commented#5 this solves the problem. So the problem occurs with VBO or views?
Comment #7
joachim commentedThe problem is the IDs we are giving to the derived Flag action plugins:
Then contain a dot, which isn't allowed as a key in the Views settings.
Comment #8
tiwiex commentedjust encountered this. In a nice way, I am happy I am not alone. It means I am doing the right thing and using beloved Drupal. What is the final solution to resolve this?
Comment #9
tiwiex commentedHmmm. The node solution in #5 works fine. Is this a part of VBO or Views? If not VBO, do we still need VBO?
Comment #10
tiwiex commentedThanks Andy_D
Comment #11
joachim commentedThere is a bug in Views for filter handlers that save their options in such a way that causes this error. Might be related.
Comment #12
graber commentedOk, why not change the dot in
EntityFlagActionDeriverto something else that is supported by the coreConfigBase::validateKeys?'id' => $flag_id . '.' . $action,IMO not allowing dots makes sense because a dot means a lower nesting level in config structure and in this case we're on the same level even if it's a derivative and from the Flag module point of view it may be a lower level.
Here's a patch that'll do for VBO but it may not be sufficient for the core bulk form.
Comment #14
interdruper commentedAt least #12 allows to use VBO & Flag together without the exception.
But I found the fix brings problems when importing/exporting flags configuration, colons do not like to Config Manager.
Needs work, I' afraid.
Comment #15
interdruper commentedRelated: #2780869: Cannot save a view where a filter value option contains a period
Comment #16
socketwench commentedSadly I had similar problems. I tried doing a search and replace on the config, but no dice.
Comment #17
KilianM commentedSaving is possible by temporarily commenting the if in validatekeys function of Configbase.php file but this is not a solution.
Need a patch.
Comment #18
benjifisherThanks all for creating this issue and the work so far! I ran into this problem today.
I do not claim to understand the problem, but I will try standing on the shoulders of giants and do something similar to the patch in #12. Instead of
.or:, both of which cause problems, why not use_? This works in my limited testing so far.Limited testing: I saved the view, exported and re-imported the site configuration. I cleared caches a few times while I was at it. So far, so good. And the publish/unpublish operations seem to work.
Comment #19
socialnicheguru commentedWhen I include this patch #18 I can no longer add sites to a platform using Aegir (http://drupal.org/project/aegir). I get an out of memory error.
Comment #20
dqd@SocialNicheGuru: I doubt that this is related.
BTW: Does Aegir support D.8 projects while itself runs a D.7 core?
Comment #21
dqd@all changing the . to the _ is a simply patch, but it isn't simple to implement. Doesn't we need to rewrite all existing setups then? We possible have to make that patch part of a new release and have to warn about that there is no upgrade/migrate path then.
Comment #22
benjifisherThis patch caused problems with
system_post_update_change_delete_action_plugins()when I upgraded to Drupal 8.6.0 and ran database updates:(Got that, Google?)
In further testing, I find that I get similar errors whenever I try to add a new flag. So yes, this patch needs some work. I am updating the issue status to reflect that reality.
Comment #23
seanbThere where some places, most importantly the schema, where the changes was not added. Attached patch might fix the issue.
Comment #24
seanbOk small mistake in the previous patch. This should do it.
Comment #25
seanbThe fail in this test is probably because the flag label is generated using
$this->randomString(). This is HTML encoded which could lead to the link text not being found. Don't have time to dive further in to this, but hopefully this was a push in the right direction. Everything else seems to work as expected!Comment #26
benjifisherAfter applying the patch from #24, I find that I can create new flags, so this fixes one of the issues I reported in #22. However, when I apply the patch to a site running Drupal 8.5.6 and then upgrade to 8.6.1, I still get the error message I quoted there, so it does not seem to solve that problem.
The patch updates
flag_flag_insert()so that, when a new flag is added, an action will be created with the updated ID. I think the problem is that we also have to update existing actions, either in an update hook or a post-update hook. Compare withsystem_post_update_change_action_plugins(), which makes similar changes.Comment #27
benjifisherHere is an attempt at an update function. Does it break anything?
I have not tested it much, but I have to break for today.
If we are really lucky, then the test failure will be fixed by #3000437: Force remove angle brackets from FlagCreateTrait::randomHTMLstring.
Comment #28
benjifisherI guess we got lucky! Or maybe I should just say that @seanB was right about the test failure in Comment #25.
I have tested the patch in #27, and it looks pretty good:
Apply patch,
drush updatedb, upgrade to 8.6.1,drush updatedbUpgrade to 8.6.1,
drush updatedb, apply patch,drush updatedbThe update function that I added in #27 seems to fix the errors I reported in #22. The changes from @seanB in #24 seem to fix the problem with creating a new flag.
@dididoq, does the update function satisfy the objections you raised in #21?
Note that the bug described in this issue is that you cannot create a view with a VBO field, whether or not you enable the flag/unflag options in the VBO field. I think that the patches here fix that bug. If I go further, then I see a new error. If I enable the action associated to a flag in my VBO field, and then try to apply the flag to one or more nodes, then I get the error
Comment #29
ohmdesbois commentedPatch #27 work for me with 8.5.7 version.
Thanks
Comment #30
socketwench commentedThat's a pretty clever solution!
Comment #32
socketwench commentedThanks all!
Comment #34
dqdyay! +1 @ all.
Comment #35
grimreaperHello,
Thanks all for this issue and the solution. I just encountered the problem and patches from this issue and #2974902: The "flag_action:email_user.flag" plugin does not exist. in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition fixed the problem.
I suggest to publish a new version as the 4.0-alpha3 is more than a year old.
Comment #36
mayilks commentedI am facing an issue, when i use "User VBO(views bulk operation)" to update the notification interval with the help of Message Digest module.
When I try to submit the VBO form from front end it gives the below error
Error: Call to a member function actionAccess() on null in Drupal\message_digest_ui\Plugin\Action\DigestInterval->access()
Please anyone help me in this issue.
Comment #37
iuana commentedI am getting also the same error as on #36. I am using VBO 2.x version, drupal 8.7.1.
In my view I use (views bulk operations) as field instead of "Node operations bulk form" field.
This field permit me to run the action in a batch set up in the view and in case of multiple rows the site will not crash.
Error: Call to a member function actionAccess() on null in \flag\Plugin\Action\FlagAction->access() (line 82 ofI used the patch from #27 and the issue is still here.
Any idea?
Comment #38
akhilsoni commented@iuana I am also getting same issue while using flag with VBO, Have you find any solution ?
Comment #39
dariogcode commentedI experienced same error than #36, #37, #38. Debugging a bit I found that is because FlagAction constructor doesn't get configuration from VBO operation. I tried to determine why but no luck, then I implemented a workaround/compatibility code parsing flag type and action from plugin id. Patch Attached
Comment #40
dariogcode commented#39 but with better formatting.
Comment #41
artem_sylchukI think it doesn't make too much sense commenting the closed issue, but #40 has literally saved my day.
It is worth to open the separate issue I guess.
Comment #42
swirtThis is a bit odd having patches contributed to an issue that is already patched and closed. If this stands a chance of getting in, either a new issue needs to be created, or a maintainer needs to re-open the issue. Otherwise this is just going to linger.
Comment #43
berdirYes, exactly that. There is also #3238783: Integrate with ECA where I also asked for a separate issue.
Comment #44
benjifisherI added #3317113: Call to a member function actionAccess() on null and attached the patch from #40 here.
Let this issue rest in peace.