Closed (fixed)
Project:
Feeds Tamper
Version:
8.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
22 Oct 2018 at 19:04 UTC
Updated:
3 Jul 2019 at 18:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
megachrizYes, this is a feature that is planned to be added. Apparently, there wasn't an issue for it yet, so thanks for creating that.
It may take a while before I've time to address this. I give Feeds and Feeds Migrate more priority.
Patches are welcome of course!
Comment #3
tclark62 commentedThis patch adds the ability to give each plugin instance a unique name. It also displays those names on the Tamper List Form along with the other plugin information.
Comment #5
tclark62 commentedTrying patch again. Feedback is welcome; I'm relatively new at contributing patches from scratch.
Comment #7
tclark62 commentedOne more time!
Comment #8
tclark62 commentedCorrecting the file names.
Comment #9
megachrizA patch for a module need to be created from within the module folder.
Edit: I see you just did that!
Comment #11
tclark62 commentedAdded testing of UI for new field.
Comment #13
megachrizThe name for the new setting is not consistent in the patch. In some case it is called "name", in other cases "tamper_name". I think I should call it "name" everywhere.
Comment #14
megachrizOr perhaps "label" is the better name for this setting. "Name" could also mean machine name, I think "label" covers its use better.
Comment #15
tclark62 commentedGood point about the inconsistency! I changed from tamper_name/name to label.
The only reason I didn't use 'Label' initially was because I think the tamper plugin types have labels, but I think it's fine to call it the label since it's for the individual tamper rule, not the plugin type in general.
I'm still learning how to properly write tests, so if you could offer any feedback on what's wrong with those, I'd be happy to adjust accordingly! (I say this since I know that this patch will fail the module UI tests.)
Comment #17
megachrizI think the issue is that 'label' doesn't initially exist on the configuration array. Tamper plugins have the method
getSetting()that returnsNULLwhen the config key does not exist. Thus I think$this->plugin->getSetting(self::VAR_TAMPER_LABEL)would at least fix a part of the test failures.Extra whitespace here.
The first character of 'Label' is capitalized here. It should be lowercase.
Comment #18
tclark62 commentedYup, that makes sense. Thanks for the feedback, very helpful! I added a couple checks to make sure the label is there (on the edit form and on the list form). Even though the field is required, I thought that would be helpful in case anyone applies it as a patch.
Edit: The patch is named improperly...
Comment #20
megachrizThat test failure makes no sense to me.
This could be made simpler by calling
getSetting()on the Tamper plugin.Comment #21
tclark62 commentedYou're right, I did that the wrong way. I corrected that and added the last of the testing information that should be necessary.
Comment #22
tclark62 commentedCorrected the proper way to get the label value in the
prepareConfig.Comment #23
tclark62 commentedMinor coding standard correction.
Summary of this patch: Adds a Label to each Tamper field, which is displayed in the list of Tamper fields so that you can give each a custom label which allows you to identify which is which. This doubles as a way to ascribe a plain language phrase to what a potentially complicated replacement pattern is doing.
Comment #24
megachrizIt took me a while before I got time to look into this issue again, thanks for the patches!
I've updated the code with the following changes:
Comment #26
megachrizCommitted #24 with a small difference in the config schema file: I added the declaration of 'label' before 'description'.
Comment #27
megachriz