Autosave publish process does not acknowledge pathauto deactivation

Created on 22 May 2025, 11 days ago

Postponed on ๐Ÿ“Œ Confirm Semi-coupled form elements can work with State API visibility Active - which is needed to make the "Generate automatic URL alias" checkbox work at all

Overview

This probably isn't pathauto specific, but this is where I spotted it.

If pathauto is enabled and "Generate automatic URL alias" is unchecked in the XB form, the pattern will still be applied.

I found a quick fix for this by adding the following to the APIAutoSaveController

 if (get_class($entity->path) === 'Drupal\pathauto\PathautoFieldItemList' && $auto_save['data']['entity_form_fields']['path[0][pathauto]'] === FALSE) {
          $entity->path->__set('pathauto', 0);
        }

I think there's a tidier solution available, but starting with something that works certainly can't hurt.

Proposed resolution

User interface changes

๐Ÿ› Bug report
Status

Postponed

Version

0.0

Component

Auto-save

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States bnjmnm Ann Arbor, MI

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

Comments & Activities

  • Issue created by @bnjmnm
  • ๐Ÿ‡ซ๐Ÿ‡ฎFinland lauriii Finland

    This seems potentially duplicate of ๐Ÿ› XB pages doesn't respect Pathauto widget Active or maybe there are two separate problems?

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States bnjmnm Ann Arbor, MI

    or maybe there are two separate problems?

    At least as-reported this issue is different. The problem reported here is specifically about the publish process not respecting the "Generate automatic URL alias" setting, while issue #3525070 states the the problem is a failure to do the desired "Pathauto should skip generating a new path when there is no pattern"

    I wouldn't be surprised if the solution to #3525070 occurs in the same place as the solution to the problem reported here, but there's not yet enough info to consider these issues duplicates.

  • ๐Ÿ‡ซ๐Ÿ‡ฎFinland lauriii Finland

    Spent few minutes debugging this to make sure this isn't a duplicate and I agree.

    It looks like the problem here is that \Drupal\experience_builder\ClientDataToEntityConverter::setEntityFields has special handling for boolean fields. However, that handling does not account to the fact that fields can have multiple properties, and therefore other field types could include a boolean field. This is why the path field is not being detected for having a boolean, which is added by \Drupal\pathauto\PathautoWidget::formElement.

    This problem seems pretty fundamental because you could run into this with other field types too. The simplest example would be Field Union fields. Updating issue summary based on this.

  • ๐Ÿ‡ซ๐Ÿ‡ฎFinland lauriii Finland

    I don't think this needs to be postponed. This should work regardless of the States API not working.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States bnjmnm Ann Arbor, MI

    I had this postponed on the State API checkboxes issue becausei I canโ€™t manually reproduce the problem without the State API working with that widget. Based on the above it sounds like this or something else representative of the situation can be reproduce me - could the issue summary be updated with these steps?

  • ๐Ÿ‡ซ๐Ÿ‡ฎFinland lauriii Finland

    Adding steps to reproduce

  • ๐Ÿ‡ซ๐Ÿ‡ฎFinland lauriii Finland

    There could be more than one problem here. I was able to get the boolean accounting to work but regardless of that this is not working. The value is missing when $items->getValue() gets called on that field because \Drupal\Core\TypedData\Plugin\DataType\Map::getValue ignores the pathauto property because per \Drupal\pathauto\PathautoItem it's a computed field.

  • ๐Ÿ‡ซ๐Ÿ‡ฎFinland lauriii Finland
  • ๐Ÿ‡ซ๐Ÿ‡ฎFinland lauriii Finland

    Looks like this is potentially also impacting ๐Ÿ› Create New Revision checkbox is always unchecked and doesn't create revision Active .

Production build 0.71.5 2024