Closed (fixed)
Project:
Flag
Version:
8.x-4.x-dev
Component:
Flag core
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 May 2015 at 08:08 UTC
Updated:
10 Sep 2015 at 22:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
berdirIf you rename the flag type plugins so that they are named after the deriver pattern, then you can drop them, the plugin system will merge them together automatically.
flag_type_node => flag_type_entity:node
You want to keep excluding flagging/flag_type I guess ;)
Comment #2
joachim commented> You want to keep excluding flagging/flag_type I guess ;)
I'm not actually sure we do: flag_type will get excluded by #2409575: config entity types should not be flaggable, and flagging flaggings is a bit weird but there could be use cases...
Thanks for the pointers :)
Comment #3
socketwench commentedI never liked the $ignoredEntities system. It always seemed like a stop gap then, but I didn't have a better idea.
This morning I'm wondering if what we can do is add a method to the FlagTypeInterface to list the supported types with a weight. Then we can enumerate all the plugins passing them a list of all entities. Then each plugin can suggest the types it supports by attaching themselves to the entity type in the list. Then the plugin manager can use the weights to sort out who handles what. The EntityFlagTypeDeriver can suck up whatever's left, removing config entities.
Comment #4
joachim commentedThat sounds a little over-engineered to me. According to Berdir in #1, we can just name the plugins a certain way and the core plugin manager should know to override the basic one.
Comment #5
socketwench commentedI find relying on naming a little obscured in this case. I'd rather do a little exploratory coding before I mark this won't fix.
Comment #6
joachim commentedBerdir makes it sound like a documented part of the plugin system, and indeed the way derived plugins are meant to work.
Comment #7
berdirI'm not sure about documented, but it's certainly a pattern that is used in core.
I actually think it's quite clear, it's a specialized form of the generic entity flag type.
Since this means we have to rename the plugins anyway which makes this an API change, maybe this would be a good moment to get rid of the strange flagtype_ prefix in the plugin ID's? Then it's just entity:node for example.
Comment #8
joachim commented> Since this means we have to rename the plugins anyway which makes this an API change, maybe this would be a good moment to get rid of the strange flagtype_ prefix in the plugin ID's? Then it's just entity:node for example.
Yeah, that makes sense.
Plugins IDs are usually seen in the context of their plugin type, eg 'flag.flag_type.plugin.flagtype_entity:user', so the second 'flagtype' is redundant.
Comment #9
socketwench commentedComment #10
giancarlosotelo commentedRerolled and also removed the 'flagtype' where was needed included 'flagtype_entity'.
Comment #11
socketwench commentedApplies and tests clean.
Random idea: What if instead of hardcoding exclusions, we create a "/dev/null" plugin that would prevent use? That way, modules could still provide a flagtype plugin for excluded plugins.
Comment #12
martin107 commentedComment #13
joachim commentedHaven't we just about removed all the exclusions? Either that, or there are issues for that floating around. I certainly remember thinking we'd be removing the exclusion of 'flagging' and letting people tie themselves in knots if they want to ;)
Comment #14
socketwench commentedProbably, I've been so busy this summer I've had a hard time keeping track. Specifically, I was thinking of config entities, since I can imagine someone coming up with a good use case, even if we can't.
Comment #15
joachim commented> Specifically, I was thinking of config entities, since I can imagine someone coming up with a good use case, even if we can't.
Let's cross that bridge if/when we come to it. If someone posts an issue saying they need us to be less draconian about excluding config entities, we can do what you suggest, or incorporate whatever they propose. Until then, I think this is quite probably a YAGNI.
Comment #16
joachim commented> Haven't we just about removed all the exclusions?
Once this patch is in, the only entity type being excluded is flaggings. Removing that is the subject of #2481795: unnecessary flagging in EntityFlagTypeDeriver::$ignoredEntities.
Comment #18
joachim commentedCommitted. Thanks everyone!