Reusing/calling functions in viewcomposers

This example is for Sage9 but I think sort-of-conditional Traits might be the answer here.