Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 294902

CustomBlock bundle() and id() needlessly rely on EntityNG getters

$
0
0

CustomBlock has

  public function bundle() {
    return $this->type->value;
  }

This relies on EntityNG magic whizbang.
Depending on where in the callstack this gets called (#1969728: Implement Field API "field types" as TypedData Plugins needs to call $entity->bundle() while the FieldItem object for 'block_body' is being created, during entity_create()), it seems everything might not be properly initialized, and the above returns NULL.

CustomBlock extends EntityNG, and EntityNG just returns $this->bundle, which just works.
Not sure why CustomBlock tries to do differently, but it doesn't seem needed :-)

Same thing for id().


Viewing all articles
Browse latest Browse all 294902

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>