I was wondering what is the correct alternative of .inc files in Drupal 8? That is to say, if I want to create some functions that should be only be loaded when required, like it was with module_load_include()
in D7. Though this function is still there in D8, I hear that this is not the best procedure. Is that so?
I have read somewhere, that using PHP traits
is considered a better practice here. However, not sure if use
ing a trait
inside a .module file is a good approach.
Any help?