Problem/Motivation
We had our site set at 3x-dev which was, admittedly, not a great idea. When working on a feed after module updates, we noticed that, on the Mappings page, when selecting a source, there was no longer an option for "New Source" in the dropdown.
We are running 3x-dev on Drupal 9.3.4 with PHP 8. When I go to the "custom sources" tab, it tells me to add it through the drop-downs on the Mappings page.
Something happened that isn't being caught by updb.
Switching to Alpha 11 has fixed the issue. I just wanted you to know that it's possible this might be breaking existing feeds.
Steps to reproduce
- Use a parser that does not extend the ParserBase class. For example the parser "Parser with mapping form" from the module "feeds_test_plugin".
- On alpha11, confirm that the option to add a new custom source is available.
- Update to the latest dev and run updb/cr as normal.
- The add new source option for the mappings dropdowns will be gone.
Proposed resolution
The issue can possibly be fixed by moving code from ParserBase to MappingForm. More specifically code from ParserBase::mappingFormAlter() and ParserBase::getCustomSourceOptions(). It's possible the implementation in Feeds Extensible Parsers need to be updated as well after this code has been moved.
Remaining tasks
Add a functional test that checks if custom sources can be added when using the parser "Parser with mapping form" from the module "feeds_test_plugin".Add a comment to "ParserWithMappingForm" that it is intended to not extend ParserBase.Move some code from ParserBase to MappingForm (see Proposed resolution).- Update Feeds Extensible Parsers code. See #3209655: Integration with feeds custom source UI.
This was originally a comment on 2938505
Issue fork feeds-3263399
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
megachrizWhich parser do you use?
Can you share a configuration file from the alpha11 feed type that didn't update well?
Comment #3
loopy1492 commentedHey, Chriz. Just to clarify, we have been set at 3x-dev. On production, we were running off a build that happened on 12/23/21. This config export should represent whatever commit was at the HEAD of that branch at that time. I'm not totally sure if that's the same as the Alpha 11 build.
Comment #4
megachrizThe build on December 23, 2021 is the same as alpha11. The first commit since the alpha11 release was on January 22, 2022.
I see the parser is called "tracking". Does that parser extends \Drupal\feeds\Feeds\Parser\ParserBase? Because I think that would probably solve the issue. But if it doesn't, then it's strange that the option "New source" is not available anymore, because that logic was already in the ParserBase class.
Maybe I'll check to see what happens if you use a parser that doesn't extend that class.
Comment #5
loopy1492 commentedHey, Chriz.
It does appear that this site is using a custom parser. That's quite vexing. I appreciate your help on this. Some new fields I'm adding weren't being inserted and now I know why.
As to the other issue, right now the parser is using the following:
```
class TrackingParser extends PluginBase implements ParserInterface {
```
Comment #6
megachrizAh, I see that it isn't extending ParserBase. I'll see if I can do something about custom parser plugins that only implement the interface.
Comment #7
megachrizI've been able to reproduce the issue with the parser "Parser with mapping form" from the module "feeds_test_plugin" (can be enabled when activating
settings['extension_discovery_scan_tests'] = TRUE;in settings.php). Adding a custom source is available on alpha11 for this parser, but not on latest dev.So I think this needs to be fixed before the next release. Marking it as a beta blocker as well.
Comment #8
megachrizAdded another task to the remaining tasks list.
Comment #10
megachrizI've written a test for this case. The fix hopefully comes somewhere in the next days.
Comment #11
megachriz@loopy1492
Can you check if with the code in the issue fork, you see the option to add a custom source again on the mapping form? You may still need to update the parser code a bit to comply with the change in ParserInterface.
Comment #12
loopy1492 commentedThanks for your work on this @MegaChriz. I'll add it to my to-do list.
Comment #13
loopy1492 commentedHey, @MegaChriz!
In my local environment, I have switched my code to reference the fork commit and run updb from the db export from production. The option "New Blank Source" now appears in the Source dropdown on the mappings page and I can add one without error. Success!
I did notice that updb doesn't create entries on the "custom sources" tab for the existing sources, though. Shouldn't it be? Note that it's possible that I threw a monkey in the works because, in production, I had created a couple while it was set to the 3x-dev branch. So it's posible that the update script looked at our feed type, saw that there were greater than zero custom sources in there, and decided not to run that part of the update. Not sure.
Comment #15
megachrizThanks for reporting back! Merged the changes.