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.
When you export a feed importer and then try to import it, if the content type doesn't exist on the site you are importing the feed importer to, it will simply create a completely blank feed importer. Is there a way we can make it smarter to alert the user that the content type and/or the fields are not correctly set in the content type?
Seems like a common mistake. Took me a bit to figure out. Thanks.
Comment | File | Size | Author |
---|---|---|---|
#16 | feeds-validate-config-2320781-15.patch | 13.81 KB | MegaChriz |
| |||
#14 | interdiff-2320781-13-14.txt | 974 bytes | MegaChriz |
#14 | feeds-validate-config-2320781-14.patch | 13.79 KB | MegaChriz |
| |||
#13 | interdiff-2320781-12-13.txt | 2.76 KB | MegaChriz |
#13 | feeds-validate-config-2320781-13.patch | 13.81 KB | MegaChriz |
Comments
Comment #1
MegaChriz CreditAttribution: MegaChriz commentedI can confirm that when importing an importer using admin/structure/feeds/import, there is no alert about a non-existing content type and that on the mapping page some of the targets say "missing". In my case, the created importer is not completely "blank". All the "settings" (basic settings, fetcher settings, etc.) are still there. It's just the mapping that can be qualified as "blank". I agree a warning message would be nice here.
Comment #2
Pravin Ajaaz CreditAttribution: Pravin Ajaaz commentedComment #3
twistor CreditAttribution: twistor commentedWe should do some validation.
Checking the content type would be a good start. I don't think we should validate that all of the fields exist, since the missing mapping is fine.
Comment #4
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedHere is a first step at this.
getConfigAllowedValues()
:This allows Feeds plugins to set the allowed values per config key. This is handy for the processor's bundle setting and - when #2529538: Generic entity language support. is done - for the processor's language setting.
validateConfig()
:This allows Feeds plugins to validate the config. Plugins implementing this method should return an array of error messages.
getConfigAllowedValues()
to set allowed values for the bundle setting.validateConfig()
to execute the same method on the fetcher, parser and processor that it contains.feeds_ui_edit_page()
call, thus on every importer config page.Caveats, further improvements
validateConfig()
andconfigFormValidate()
.validateConfig()
.Suggestions and feedback are welcome!
Comment #6
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedSome of the test failures were caused by a bug in the test "FeedsUIUserInterfaceTestCase". I've fixed that in #2574789: Wrong processor settings set in FeedsUIUserInterfaceTestCase::testImporterImport().
Another bug in the patch from #4 was that all importers you were trying to import became invalid, because
form_error()
was called regardless if there were errors or not. This is fixed in the attached patch. Caveats noted in #4 still apply.Comment #7
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedThis patch does the following in addition of the previous patch:
FeedsConfigurable::getConfigAllowedValues()
is removed because the error message for an invalid config option would refer to the untranslatable config key instead of config label.FeedsImporter::validateConfig()
.All caveats reported in #4 are handled with the patch except the following (minor) one:
Comment #9
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedOops, accidently showed an error message of an unavailable plugin when the plugin class was *not* an instance of FeedsMissingPlugin. Should be the opposite, of course!
Comment #10
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedComment #11
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedI hope that this will make it into the Feeds 7.x-2.0-beta4 release.
Comment #12
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedReroll.
Comment #13
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedNoticed an issue with validating the selected language on the importer: every language was reported as invalid, even
LANGUAGE_NONE
! This issue is new though, it did not occur before the changes from #2788125: FeedsProcessor not respecting bundle i18n language settings.Changed language validation to use the new
languageOptions()
method, introduced into that same issue.Other then that, I think this is ready.
Comment #14
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedOops, noted a small mistake in last patch. Should have been catched by the tests though.
Comment #16
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedReroll.
Comment #18
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedCommitted #16.