They can appear in any order, but we need all 4: General information, source, destination, and data processing. That YAML looks like a lot, but it’s really just 4 sections. Migrate is one of the most powerful components of Drupal 8 core, and this configuration is your gateway to it. Read on if you want to learn more about how this config works, and how you can use Migrate to do even more amazing things… Anatomy of a migration YAML In the interest of good examples for Migrate module though, I’m going to continue. If you’re familiar with the format and the structures involved, this example is probably all you need to set up your easy RSS importer. Plugin: default_value default_value: podcast_episode Plugin: default_value default_value: 1 type: Plugin: format_date from_format: 'D, d M Y H:i:s O' to_format: 'U' source: pub_date status: Slug: stop-waiting-for-feeds-module-how-to-import-remote-feeds-in-drupal-8 title: title field_remote_url: link body: summary created: Name: image label: Image selector: 'itunes:image' ids: Name: summary label: Summary selector: 'itunes:summary'. Name: link label: 'Origin link' selector: link. Name: pub_date label: 'Publication date' selector: pubDate. Name: title label: Title selector: title. Plugin: url data_fetcher_plugin: http urls: '' data_parser_plugin: simple_xml item_selector: /rss/channel/item fields: Id: my_rss_importer label: 'Import my RSS feed' status: true source: If you aren’t familiar with this stuff yet, don’t worry! We’ll dissect this together, below. If you’re already comfortable with migration YAMLs and XPaths, just add the names of your RSS fields as selectors in the source section, map them to drupal fields in the process section, and you’re all done! Here’s my RSS importer config for your copy and pasting pleasure. One YAML file, most of which is copypasta. I’ve included a starter YAML just below, you should be able to copypasta, change a few values, and be done in time for tea.ģ) Add a line to your system cron to run drush migrate -y my_rss_importer at whatever interval you like. ![]() Migrate Tools gives us drush commands for running migrations.Ģ) Write your Migration configuration in text, and paste it into the configuration import admin page ( admin/config/development/configuration/single/import), or import it another way. ![]() Migrate Plus provides plugins for core Migrate, so you can parse remote XML, JSON, CSV, or even arbitrary spreadsheet data. Just get them into your codebase and enable them. You should be doing this with composer, but I won’t judge. Add a couple of contrib modules to provide specific plugins for XML sources and convenience drush functions, and baby you’ve got a stew goin’!ġ) Download and enable migrate_plus and migrate_tools modules. Migrate in D8 core already contains all the elements you need to build a regular importer of ANYTHING into D8. What? How?ĭrupal 8 can do all the Feedsy stuff you like with Migrate module. You can copy and paste it directly from this blog post into Drupal’s admin interface. What if I told you that it’s even better: instead of clicking through endless menus and configuration links, waiting for things to load, missing problems, and banging your head against the mouse, you can set this up with one simple piece of text. What if I told you that Drupal 8 can do everything Feeds 7 can? I suppose you could extend it to choose you own entity type, map fields etc, but that seems like a lot of work for such a simple feature. It imports content into its own Aggregated Content entity, with everything in one field, and linking offsite. Unfortunately, Aggregator gives you no control over the kind of entity to create, let alone any kind of field mapping. The next great candidate is Aggregator module (in core). If you decide to use it, don’t be mad if we break it later. It’s not ready yet, but we are brainstorming about what would be the best way forward. ![]() They’re still surveying people about what feeds module should even DO in D8. Where has that functionality gone in D8? I recently had to build a podcast mirror for a client that needed this functionality, and I was surprised at what I found.įeeds module doesn’t have a stable release candidate, and it doesn’t look like one is coming any time soon. ![]() Feeds 7 made it easy (-ish) to click together a configuration that matches an RSS (or any XML, or CSV, or OPML, etc) source to a Drupal entity type, maps source data into Drupal fields, and runs an import with the site Cron. How do you import an RSS feed into entities with Drupal 8? In Drupal 6 and 7, you probably used the Feeds module.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |