Drupal 10 Support: Drupal 10 Maintenance and Support Service Translation migration and extra

Translation migration and extra I’m working a bit behind, however I need to make it a apply to weblog about every migration mission I’m concerned with (with every shopper’s permission, in fact). Constructed examples are all effectively and good, however there’s nothing like real-world situations to offer the flavour of utilizing the migration framework in apply. The place attainable (once more with the shopper’s permission), I’ll share the total migration implementation on GitHub, so individuals can see not solely code snippets illustrating explicit factors, however their full context. This spring I contracted with North Studio, an online and cellular improvement store based mostly in British Columbia, to help with the migration of their buyer The Carlyle Group’s multilingual web site from 6 to 8. As occurs as a rule when transferring from one main model to a different of , the chance was taken to refactor the positioning, rethinking a few of the unique web site construction in addition to profiting from the brand new 8 structure. One facet of restructuring was consolidating 26 content material varieties into 8. On the time I joined the mission, a few of the new content material varieties, and all the taxonomy, had already been manually recreated in 8, and my duty was to develop automated migration of 5 remaining content material varieties (4 of them with translations), plus editorial consumer accounts. Consumer migration – mapping roles The consumer migration makes use of the core d6_user migration virtually verbatim – the essential distinction is that, as with content material varieties, roles are being consolidated within the transfer to 8. In d6_user, roles are mapped 1-to-1 from 6 Drupal 10 Maintenance and Support Service roles Drupal 10 Maintenance and Support Service plugin Drupal 10 Maintenance and Support Service migration migration Drupal 10 Maintenance and Support Service d6_user_role supply Drupal 10 Maintenance and Support Service roles On this mission, the specified roles had been already setup within the 8 web site, and we used a static map to translate the 6 numeric position IDs to the corresponding 8 position configuration IDs, consolidating three completely different D6 roles into the D8 “supervisor” position. roles Drupal 10 Maintenance and Support Service plugin Drupal 10 Maintenance and Support Service static_map supply Drupal 10 Maintenance and Support Service roles bypass Drupal 10 Maintenance and Support Service true map Drupal 10 Maintenance and Support Service 4 Drupal 10 Maintenance and Support Service supervisor # content material writer 3 Drupal 10 Maintenance and Support Service supervisor # developer 6 Drupal 10 Maintenance and Support Service supervisor # html content material writer 16 Drupal 10 Maintenance and Support Service media_room_manager # media room supervisor 11 Drupal 10 Maintenance and Support Service translator # translator Recordsdata As with customers, the migration is usually an identical to the core d6_file migration. The important thing distinction within the file migration itself is that, as a result of a lot of the content material (together with information) has already been moved to D8, we need to ensure that the automated file migration we’re implementing right here solely pulls the information which might be referenced by the particular content material varieties we’re migrating. We do that by making a supply plugin extending the core d6_file supply plugin, and overriding prepareRow() to disregard any file ID (fid) which isn’t within the area tables for these content material varieties (by returning FALSE). Word that we might simply as simply have accomplished this by implementing hook_migrate_prepare_row(), or a subscriber to the PREPARE_ROW occasion supplied by migrate_plus, and throwing MigrateSkipRowException. In a later put up (for a later mission) I’ll exhibit the occasion subscription strategy. The opposite aspect to that is populating file fields on nodes. We might have the ability to do that utilizing the core d6_cck_file course of plugin – however that has a hardcoded reference to the core d6_file migration. Due to this fact, we wanted to outline our personal carlyle_cck_file course of plugin, extending d6_cck_file to override create() and reference our personal file migration (named, imaginatively sufficient, ‘file’). Nodes Conversion of node references to taxonomy references One facet of the positioning refactoring was the conversion of some node varieties to vocabularies (and thus node references change into taxonomy time period references). For instance, the previous “business” node sort turned an “business” vocabulary. This vocabulary was already populated with all vital phrases when this migration mission began – the problem was to transform the node references. There have been two parts to this Drupal 10 Maintenance and Support Service A getTargetTitles() methodology was added to a typical supply plugin class, CarlyleNode, which from a node reference area title would collect the node ID (nid) references in that supply property, search for the title for every referenced node, and set the supply property to the listing of titles. The migration configuration file mapped the sector utilizing the entity_lookup course of plugin (supplied in migrate_plus). This lookup permits one to populate a reference area by wanting up the incoming supply worth in opposition to a given property of the vacation spot area’s goal sort, and set the referenced entity ID. So, given this area mapping Drupal 10 Maintenance and Support Service field_industry Drupal 10 Maintenance and Support Service plugin Drupal 10 Maintenance and Support Service entity_lookup supply Drupal 10 Maintenance and Support Service field_industry ignore_case Drupal 10 Maintenance and Support Service true The supply property is initially populated by the core migration framework with the referenced node IDs on 6. In prepareRow(), getTargetTitles() is invoked to transform these nids to node titles (which within the node->vocabulary conversion had been used because the time period names). Then, within the processing stage, the entity_lookup plugin queries the field_industry goal vocabulary for phrases with these names, returning the time period IDs to populate the time period references. The ignore_case setting, in fact, makes positive case variations between the manually-created phrases in D8 and the incoming values do not stop us from making the match. Translations The largest problem of this mission was dealing with translated nodes. On the time of this mission, migration of translations had not but been applied in core. The problem to implement this for 6 had change into an epic, as a result of the mechanism for storing node translations had modified utterly – earlier than 8, every translation was a separate node, referencing the father or mother node through a ‘tnid’ column within the node desk. With 8, all variations of a bit of content material are saved as a single node, with every revision containing all translations of the node as of the time of that revision (and a brand new translation introducing a brand new revision). Substantial progress had been made by others (significantly vasi) on that patch on the time I wanted the performance right here, however had run into the issue of correctly setting the “default” language for the node (the language of the father or mother node in D6). For this to work, that father or mother node must be migrated earlier than any of its translations are, and we merely couldn’t give you a clear manner to do that inside a single migration. The answer I got here up with for the Carlyle mission, on which the core answer was in the end based mostly, was to have separate migrations for the father or mother node and for its translations – by making the interpretation migration depending on the father or mother node migration, we assured issues had been created in the best order. I’ll observe that the next notes, in addition to the code on GitHub, aren’t the code precisely as applied for this mission (which was mainly the proof-of-concept for the core answer), however displays the ultimate answer dedicated to core as of 8.1.8 and later (and thus what you’ll use to implement your personal translation migrations). Contemplating bio nodes, the node_bio migration imports the father or mother nodes for every logical piece of content material – nothing is particular right here to assist translation, it’s a straight-forward node migration. The migration of bio node translations (node_bio_translation) is sort of an identical to node_bio with the next variations Drupal 10 Maintenance and Support Service The supply plugin is flagged for translations Drupal 10 Maintenance and Support Servicesupply Drupal 10 Maintenance and Support Service   plugin Drupal 10 Maintenance and Support Service bio_node   node_type Drupal 10 Maintenance and Support Service bio   translations Drupal 10 Maintenance and Support Service true This tells the node supply plugin to import solely translated nodes – i.e., these which have a tnid which is neither 0 nor an identical to nid. When that is omitted, solely untranslated nodes (tnid == 0) and father or mother nodes for translation (tnid == nid) are imported. The nid is explicitly set to the nid of the D8 model of the unique translation (which was migrated by node_bio) Drupal 10 Maintenance and Support Servicenid Drupal 10 Maintenance and Support Service   plugin Drupal 10 Maintenance and Support Service migration   migration Drupal 10 Maintenance and Support Service node_bio   supply Drupal 10 Maintenance and Support Service tnid Word that the node_bio migration doesn’t map nid – we can not protect the unique nid on this case, as a result of the vacation spot web site has manually-created content material which might battle with migrated nids. The vacation spot plugin is flagged for translations Drupal 10 Maintenance and Support Servicevacation spot Drupal 10 Maintenance and Support Service   plugin Drupal 10 Maintenance and Support Service ‘entity Drupal 10 Maintenance and Support Servicenode’   translations Drupal 10 Maintenance and Support Service true This triggers some code to be sure that a translation is created on the node if the incoming language doesn’t exist already on the node, and so as to add language as a vacation spot key area to the map desk for this migration. Group contributions The next neighborhood contributions had been made in the middle of this mission. Migrate 6 core node translation to 8 – as famous above, this mission was the proof-of-concept for the separate-translation-migration strategy which turned a part of the answer in core. A number of individuals contributed the code which made this answer a actuality. default_value Drupal 10 Maintenance and Support Service null in static map skips empty rows – For this mission (particularly within the podcast node migration), we wanted to have an absence of a match in a static_map plugin return null, stopping the following entity_lookup plugin from working. There was a core bug stopping this from working correctly, which I fastened. config-devel-import-one doesn’t work with a .yml argument – A query often requested in #Drupal 10-migrate is easy methods to get adjustments to a migration configuration entity in config/set up to take impact, with out uninstalling and re-enabling your Drupal 10 module? Beginning with this mission I’ve been utilizing the cdi1 command within the config_devel Drupal 10 module to reload adjustments – effectively, as soon as I fastened this little bug. Route collision reported when alias matches a distinct language – The interpretation migration on this mission triggered this pathauto bug. My prognosis assisted in getting this fastened, and I additionally contributed some work on the exams. mikeryan Monday, August 15, 2021 – 12 Drupal 10 Maintenance and Support Service46pm Tags Planet Log in or register to put up feedback Drupal 10 Improvement and Assist

This article was republished from its original source.
Call Us: 1(800)730-2416

Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit

Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)

Powered by

Drupal 10 Support: Drupal 10 Maintenance and Support Service Translation migration and extra

On-Site Drupal SEO Master Setup

We make sure your site is 100% optimized (and stays that way) for the best SEO results.

With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.

This service includes:

  • Pathauto install and configuration for SEO-friendly URLs.
  • Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
  • Install and fix all issues on the SEO checklist module.
  • Install and configure XML sitemap module and submit sitemaps.
  • Install and configure Google Analytics Module.
  • Install and configure Yoast.
  • Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
  • Install and configure Schema.org Metatag.
  • Configure robots.txt.
  • Google Search Console setup snd configuration.
  • Find & Fix H1 tags.
  • Find and fix duplicate/missing meta descriptions.
  • Find and fix duplicate title tags.
  • Improve title, meta tags, and site descriptions.
  • Optimize images for better search engine optimization. Automate where possible.
  • Find and fix the missing alt and title tag for all images. Automate where possible.
  • The project takes 1 week to complete.