You can extend the functionality of your Blocks by adding methods to individual ones or your DefaultBlock
but this limits their reuse between projects.
Another option is to use Traits and we have added some helpful features to get the most out of them. This is how we implement features like converting Markdown.
You can also use Traits onPages
in exactly the same manner.
Maybe you need a method that truncates selected strings when a Block is created. You add this to a trait and want the method to be run automatically. This can be done by adding a method called initTraitName
to your trait as follows.