Add support for pathauto states (path alias states)

Created on 4 November 2021, about 3 years ago
Updated 31 July 2024, 5 months ago

Problem/Motivation

You may have installed and enabled the pathauto module. If so, you may have configured some nodes/users/taxonomy terms to have manually-configured URL aliases. And if so, this important information will not be exported/imported by eme.

The information about which content has a manually-configured URL alias is stored in the key_value table. Example excerpt from a database dump:

INSERT INTO `key_value` VALUES ('pathauto_state.node','11',_binary 'i:0;');
INSERT INTO `key_value` VALUES ('pathauto_state.node','77',_binary 'i:1;');
INSERT INTO `key_value` VALUES ('pathauto_state.node','99',_binary 'i:1;');
INSERT INTO `key_value` VALUES ('pathauto_state.taxonomy_term','1',_binary 'i:0;');
INSERT INTO `key_value` VALUES ('pathauto_state.taxonomy_term','10',_binary 'i:0;');
INSERT INTO `key_value` VALUES ('pathauto_state.user','43',_binary 'i:0;');

I.e., the checkbox for "Generate automatic URL alias" is unchecked if the value is 0.

From the source code to pathauto, file src/PathautoWidget.php, it seems that you can access these values using:

    $entity = $items->getEntity();
    ...
    ... $entity->path->pathauto ...

Steps to reproduce

In the source Drupal which has pathauto enabled, uncheck the checkbox for "Generate automatic URL alias" for a node. Export the content using eme, and import it into the destination Drupal that also has pathauto enabled with the same configuration. Observe that in the destination Drupal, the "Generate automatic URL alias" is now checked.

Proposed resolution

If the source Drupal has the pathauto module enabled, then include the pathauto_state setting for each node within the exported data.
If the destination Drupal has the pathauto module enabled, then use the pathauto_state setting for each node within the exported data to recreate the entries in the key_value table.

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia richard.walker.ardc

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024