12/25/2023 0 Comments Drupal admin toolbar doubleOnce you have checked that the URL works and produces a valid XML structure, that’s publicly accessible, we can start setting up our D8 site for import! This is important since otherwise the D8 feed importer will not be able to consume the data, because otherwise SSO will intercept the HTTP request and redirect to its login page! Set a Path on the DATA EXPORT SETTINGS section, and use None on the Access configuration, so the view is publicly accessible. Keep in mind that the XML elements will get their names from the labels assigned to the fields, so I recommend using lowercase, simple names so it’s easier to configure the feed importer later I chose some basic options but these are personal:Īdd the fields you need to export. So this is what we need to do: Source D7 siteĬreate a publicly accessible page view that exposes the data in XML format using this module’s view mode:Ĭonfigure the XML format in a way that’s easy to parse by the consuming feed importer. I decided I would go for XML since it’s pretty resilient to inline some encoded HTML (JSON would also do, but I haven’t tried it yet). What is the solution? Here it goes! Solution The rest of parsers are not useful for my custom content. So in principle CSV should work, but after analyzing the content I realized CSV would cause trouble since my content contained tabs, semi-colons, quotes, line-breaks, and all sorts of characters that would be problematic for such simple and error-prone format. In order to have 2) once we have 1) the feed importer should be able to process a custom XML/JSON/CSV dataset, and by default the Feeds module in D8 only allows for the following parsers: In order to have 1) we need to be able to expose the data in a machine-readable format, but Drupal 7 only offers RSS out of the box, and for most content types this is simply not enough (no possibility to configure fields or XML structure, RSS is a closed format) So I thought about this: General ApproachĬreate some view on the D7 site that will expose the content in a machine-readable format (XML, CSV, JSON…)Ĭreate a feed importer on the D8 site that will consume the newly created endpoint and put this data into nodesĮasy, right…? Well, not in Drupal’s world I thought to myself: “even if the creation of the structures has to be manual, there must be a way to export the content in an automated way”. Recently I faced the situation where I had built the structures already existing on a D7 site into a new D8 site, and I wanted to try them out with some content.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |