Noticed this while looking at something else, might as well fix it in public.

The style of the property name entity_type should be entityType... and it is an implementation detail so I want to hide it from public access.

CommentFileSizeAuthor
entityType-0.patch1.18 KBmartin107
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

martin107’s picture

Issue summary: View changes
joachim’s picture

Yeah, there's a getter method on the Flag entity for the entity type ID.

Dunno why it's set to an empty string default rather than just NULL -- but that's off-topic.

socketwench’s picture

@joachim: Ummm, I think this patch is about the flag type plugin, rather than the entity itself.

joachim’s picture

Yup. What I mean is that if you have a flag and you want to know the entity type it's for, there's what you need on the flag already. You don't even need to go pick up the plugin.

I don't think we ever work with a plugin as a thing on its own do we? It's always there underneath a flag AFAIK.

socketwench’s picture

But you do need it here because the EntityFlagType is a derivative and requires to know the entity type that it's representing. It uses that to get the entity type's view modes. I'd rather not double-link the flag entity and the plugin because that can complicate refactoring later on.

martin107’s picture

@socketwench++

I couldn't find the words, but that is what I wanted to say.

socketwench’s picture

Status: Needs review » Reviewed & tested by the community

Anyways, the patch looks good.

My one concern is how does this affect the entity_type annotation we use for @FlagType. The tests are passing, but part of me thinks that variable was public for a reason...

joachim’s picture

> But you do need it here because the EntityFlagType is a derivative and requires to know the entity type that it's representing

I think we're at crossed wires here... the plugin can access its own $entity_type variable. What I was pondering aloud was whether anything ever needs to do $plugin->entity_type.

socketwench’s picture

I think we're at crossed wires here... the plugin can access its own $entity_type variable. What I was pondering aloud was whether anything ever needs to do $plugin->entity_type.

Ooooooh. Okay. Right now, I don't think so with the exception of the annotation. I seem to remember the @FlagType's entity_type key needing to map to the entity_type variable on the plugin, but I could be thinking of something else. I don't think anything else bothers to access it since it only seems to be used to load the view modes in one place for the derivative.

joachim’s picture

Status: Reviewed & tested by the community » Fixed

Committed.

  • joachim committed 0b43fce on 8.x-4.x authored by martin107
    Issue #2494455 by martin107: Changed EntityFlagType::entity_type to...

Status: Fixed » Closed (fixed)

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