Following on from Call to undefined method getSetting() in all tampers it would be useful to allow all tamper plugins to hold configuration.
Proposed solution is to move the functionality from ConfigurableTamperBase / ConfigurableTamperInterface to the base plugin. This will allow more consistent use of the plugins by third party modules, and allows modules like feeds tamper to extend the configuration / access it in a more consistent manor.
ConfigurableTamperInterface will be deprecated and can be safely removed once the checks in feeds tamper UI are removed.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | tamper-make-all-plugins-configurable-2948543-5.patch | 7.9 KB | ericgsmith |
| #5 | interdiff-294853-4-5.txt | 890 bytes | ericgsmith |
| #4 | tamper-make-all-plugins-configurable-2948543-4.patch | 7.84 KB | ericgsmith |
| #3 | interdiff-2948543-2-3.txt | 2.96 KB | megachriz |
| #3 | tamper-make-all-plugins-configurable-2948543-3.patch | 8.18 KB | megachriz |
Comments
Comment #2
ericgsmith commentedComment #3
megachrizThis goes one step further by doing also the following:
getSetting()in TamperInterface. I understood from a comment by either @bojanz or @mglaman somewhere in the Commerce issue queue that it is a good practice to have all public methods defined in an interface as well. In #2946698: Call to undefined method getSetting() in all tampers I'm mocking TamperInterface and I'm planning to mock the getSetting() method in a test.Comment #4
ericgsmith commentedThanks, sounds good to me.
Rerolling against changes dev.
Comment #5
ericgsmith commentedJust a small change, if we are exposing get setting to the world we need to check that whatever value is request actually exists in the config array.
Comment #6
megachrizGood idea to return NULL in case the setting does not exist.
I was also thinking of adding a method called
setSetting()as the counterpart for thegetSetting()method. Could also be handled in a follow-up though. I think that Feeds Tamper won't need it. Feeds Tamper would just usesetInstanceConfiguration().Comment #7
ericgsmith commentedCommitted