Problem/Motivation

NodeType, Vocabulary, CustomBlockType, ... duplicate a bunch of code to call the bundle hooks in case they're created/updated/deleted.

Proposed resolution

A common base class would allow us to unify that.

Remaining tasks

User interface changes

API changes

Comments

tim.plunkett’s picture

How about a trait?

berdir’s picture

Status: Active » Needs review
StatusFileSize
new8.45 KB

That doesn't work, this is all part of the postSave()/postDelete() call chain, we can't do that in a trait. And helper methods would be fairly useless for that, we're talking about 1-3 lines of code for each case, it's nothing complicated, just something that's easily forgotten... Vocabulary is missing delete for example.

larowlan’s picture

  1. +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBundleBase.php
    @@ -0,0 +1,46 @@
    + * Entity types that what to use this base class must use bundle_of in their
    + * annotation to specify for which entity type they are providing bundles for.
    

    Entity types that whatwant to use this base class must use bundle_of in their annotation to specify for which entity type they are providing bundles for

  2. +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBundleBase.php
    @@ -0,0 +1,46 @@
    +  /**
    +  /**
    

    dupes

Other than that, RTBC

berdir’s picture

Yeah, I it was late last night :)

larowlan’s picture

Status: Needs review » Reviewed & tested by the community
+++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBundleBase.php
@@ -12,13 +12,12 @@
  * annotation to specify for which entity type they are providing bundles for.

I still think the extra 'for' here isn't needed but meh

rtbc if green

andypost’s picture

nice clean up

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.x, thanks!

  • Commit 177b86e on 8.x by catch:
    Issue #2261369 by Berdir: Introduce a common config entity base class...

Status: Fixed » Closed (fixed)

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