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

Simplify DerivativeInterface implementations by refactoring duplicated code to a base class

$
0
0

Most DerivativeInterface implementations share common code(getDerivativeDefinition() and data (protected $derivatives).

Refactoring them to an abstract base class would help us remove some duplicated code and reduce the apparent complexity of plugin derivative creators by making them only have to write one method (getDerivativeDefinitions()).

The already copy/pasted implementations are present in:

  • BlockPluginUI
  • CustomBlock
  • DefaultWizardDeriver
  • LanguageBlock
  • Layout
  • SelectionBase
  • SystemMenuBlock

Alternate implementations are present in AggregatorCategoryBlock and AggregatorFeedBlock (more inline code), EntityDerivative (slightly different), and MockLayoutBlockDeriver and MockMenuBlockDeriver (always invoke getDerivativeDefinitions(), do not use $this->derivatives caching).


Viewing all articles
Browse latest Browse all 293467

Trending Articles



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