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

MilOrg’s picture

Category: support » feature

+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?

MilOrg’s picture

Issue summary: View changes

minor grammar correction

Liam Morland’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Issue summary: View changes