Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing into "singles" is restricted #559

Closed
nathanchicken opened this issue Jun 19, 2019 · 3 comments
Closed

Importing into "singles" is restricted #559

nathanchicken opened this issue Jun 19, 2019 · 3 comments

Comments

@nathanchicken
Copy link

nathanchicken commented Jun 19, 2019

Description

When creating a feed, I can't select a "single" section as the destination.

I am not sure if there's a real technical reason why not, but it's frustrating. We actually rarely use FeedMe for syncing an actual feed, but often use it to migrate content from old legacy sites as we rebuild them in Craft. We've got a site with quite a few single sections that need content copying in. But digging around, is there a real reason for restricting it?

I've seen that in elements/Entry.php, at about line 54 there's this:

foreach ($editable as $section) {
    if ($section->type != Section::TYPE_SINGLE) {
        $sections[] = $section;
    }
}

Which I changed to...

foreach ($editable as $section) {
    // if ($section->type != Section::TYPE_SINGLE) {
        $sections[] = $section;
    // }
}

This allowed me to choose my single. As a precaution I put a migration id into the existing single, so that when I ran the feed I could ensure that it found a match to copy the info in.

This then worked fine, but not knowing all the ins and outs of the plugin, I don't know if anything went wrong. It certainly looks fine though! I wonder if this was coded in because there's an assumption that people always import multiple entries into a section?

I appreciate people should be warned about the pitfalls of importing into a single, but I can see lots of scenarios that someone would want to import data into to a single entry. For example, perhaps someone wants to populate a data table in one single's matrix or table field, or indeed, as we do, for migrating legacy content.

Thanks

Additional info

  • Plugin version: 4.1.0
  • Craft version: 3.1.31
@brandonkelly
Copy link
Member

Feed Me currently doesn’t have the ability to limit the import to a single entry, so we’d need to add that guardrail before allowing Single sections. I’ll mark this as an enhancement request.

@maxstrebel
Copy link

I'd love to have this, too. Using it to grab common Review Rating Data to a Global Set would be awesome!

@brandonkelly
Copy link
Member

We just released Feed Me 4.3.0 with the ability to import singles (and global sets too @maxstrebel - #670 ;).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants