The order of methods in EVB was already a bit random, but #2099131: Use #pre_render pattern for entity render caching disconnected it even more from the actual execution flow.
Reordering was left for a followup to make diffs easier to review over there.
Patch reorders EVB like so:
// Instantiation
public function __construct();
public static function createInstance();
// Main API entry point & initital build
public function view();
public function viewMultiple();
protected function getBuildDefaults();
// #pre_render steps
public function build();
public function buildMultiple();
public function buildComponents();
protected function alterBuild();
// Cache management
public function getCacheTag();
public function resetCache();
protected function isViewModeCacheable();
// "Standalone field render" API
public function viewField();
public function viewFieldItem();
(yeah, that's the kind of patches I write these days :-/)
Nitpick : arguably, isViewModeCacheable() could be inlined within getBuildDefaults() ?
Comments
Comment #1
yched commentedComment #2
jibranIf there are any minor doc issues in this class which can be fixed easily we can fix those here.
Comment #3
wim leersRTBC +1
Comment #4
webchickSeems like a nice clean-up. Diff looks a bit wonky but it does appear to just move code around.
Committed and pushed to 8.x. Thanks!
Incidentally, the code snippet in the issue summary would be great to move to docs somewhere under https://drupal.org/developing/api/entity. That's definitely the clearest/most concise way I've seen the code flow here expressed.