Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I've made some code to manipulate a PHP output field.
It's lengthy and I'd like to use it in other views, so, for maintenance reasons, I'd prefer to have only one copy of the code and reference to it from inside the view itself, rather that have multiple versions of the same code in each view.
What would be considered best practise in refactoring this code and getting it referenced from the outside of the view?
i.e. is there a protocol for creating files for this and where they would be located? Would it be the sort of thing I should learn how to make a module for?
Cheers
Duncan
Comments
Comment #1
MilOrg CreditAttribution: MilOrg commented+1 on this one...
This is an excellent module, but as Duncan points out, having the ability to include a file would certainly be handy if you either have code you want to reuse in several views, or if the code for a view is lengthy so editing it within the textblock becomes cumbersome.
Ideas & thoughts?
Comment #1.0
MilOrg CreditAttribution: MilOrg commentedminor grammar correction
Comment #2
Liam Morland