- Issue created by @BramDriesen
- 🇧🇪Belgium wouters_f Leuven
I assume you mean per bot that you can configure the requst paths with
$this->condition->setConfiguration($config->get('request_path'));
like https://git.drupalcode.org/project/bothive/-/blob/1.0.x/src/Form/Bothive....
and then on the page:
$condition = $this->manager->createInstance('request_path'); $condition->setConfiguration($this->configFactory->get('request_path')); if ($condition->evaluate()
but can we differentiate this so it works for the multiple bots?
- 🇧🇪Belgium wouters_f Leuven
And that would also mean ditching the hook mechanism then - right?
Sorry haven't worked with that mechanism before. - 🇧🇪Belgium BramDriesen Belgium 🇧🇪
Yes correct :-) this basically uses the same mechanism as with core blocks.
but can we differentiate this so it works for the multiple bots?
I'll have to test, but since core is using that for blocks, I don't think it will be an issue
- 🇧🇪Belgium BramDriesen Belgium 🇧🇪
It would be nice if we could ditch this whole block of code 😅
https://git.drupalcode.org/project/oswald/-/blob/4.0.x/oswald.module?ref...
- 🇧🇪Belgium BramDriesen Belgium 🇧🇪
One more thing that came to mind that I don't have an answer for right now is that I have no idea if this logic can actually be used for a ContentEntity. Blocks and the bothive example extending ConfigEntityBase/ConfigFormBase.
So we might have to rebuild the entity for that. I see no real reason to use a content entity for this either :-) so feel free to elaborate if you have more insights on that part.
- @bramdriesen opened merge request.
- 🇧🇪Belgium BramDriesen Belgium 🇧🇪
Seems like it's working fine with content entities. Last commit is a working version! Now just to clean it up with the correct dependency injections. I also decided to keep the hook implementation since I kind of like the idea that users are still able to alter the active chatbot with custom logic via code.
I did replace the logic that this always triggers the hook, even if there is only one chatbot that passes the condition logic.
- Status changed to Needs review
over 1 year ago 5:23pm 18 April 2023 - Status changed to Needs work
over 1 year ago 5:30pm 18 April 2023 - Issue was unassigned.
- Status changed to Needs review
over 1 year ago 7:55pm 18 April 2023 -
BramDriesen →
committed f40d7911 on 4.0.x
Issue #3354704: Implement @plugin.manager.condition
-
BramDriesen →
committed f40d7911 on 4.0.x
- Status changed to Fixed
over 1 year ago 8:49pm 18 April 2023 Automatically closed - issue fixed for 2 weeks with no activity.