Closed (fixed)
Project:
Drupal core
Version:
8.4.x-dev
Component:
path.module
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
15 Oct 2017 at 02:03 UTC
Updated:
29 Jan 2018 at 21:50 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
amateescu commentedLet's try this.
Comment #4
amateescu commentedThis should fix the failing REST tests. Since the 'computed' logic has been moved to the item list class, the field item class can now behave like a regular field!
However, the path tests will start failing just like in #2905524-12: The count() method used on PathFieldItemList behaves differently if isEmpty() has been called., because this change also fixes the bug reported over there, so it gets into the same problem with the path widget.
I'm really not sure if the fixes over there are correct or not, so I'll leave it to @Berdir to take a look whenever he can.
Comment #6
jibranSo this is not a BC break?
Comment #7
amateescu commentedI don't think so, given that the general behavior of the field is not altered in any way.
Comment #8
amateescu commentedOk, I figured out how we can proceed here. We can take the 'langcode' property into account in
\Drupal\path\Plugin\Field\FieldType\PathItem::isEmpty(), which effectively makes this field "never empty", which is exactly how it behaves in HEAD.This keeps the
count($node_with_no_path->get('path')) == 1behavior, even though I think it's wrong, but we can punt on #2905524: The count() method used on PathFieldItemList behaves differently if isEmpty() has been called. to fix that.Comment #9
amateescu commented#2909183: Add path alias (PathItem) field PATCH test coverage was committed today and added some ugly code to the
PathItemclass, so let's reroll this patch on top of #2392845-133: Add a trait to standardize handling of computed item lists and remove that ugly code as well.Seems to be working fine still based on a quick local testing.
Comment #10
amateescu commentedA slight change in the title is needed as well.
Comment #11
wim leersHurray!
Quoting myself from #2909183-20: Add path alias (PathItem) field PATCH test coverage (you left a comment at -19 pointing to #9 here):
Comment #12
amateescu commentedThe parent issue moved the trait back to the typed data level so we also need a small update here.
Comment #13
wim leersThis blocks #2824851: EntityResource::patch() makes an incorrect assumption about entity keys, hence results in incorrect behavior, which is major.
Comment #14
wim leersThis is blocked on #2392845: Add a trait to standardize handling of computed item lists.
Comment #15
berdirComment #16
berdirComment #17
wim leersQueued tests for #12, but given that #9 already was green, I think it's okay to already RTBC this.
Comment #19
wim leersMust've been a random DrupalCI failure, because #12 is definitely green, despite this being marked NW. Back to RTBC.
Comment #22
larowlanCommitted as dbfe03c and pushed to 8.5.x.
Cherry-picked as ccc4d9c and pushed to 8.4.x.
Comment #23
wim leersThis unblocked:
Comment #25
karenann commentedUpon updating from 8.4.2 to 8.4.4, I found that nodes created via REST were no longer being created with the defined alias pattern.
To elaborate, I have an alias pattern so that nodes created of the type "event" have the alias pattern of "/event/[node:title]".
After the update, nodes created via REST were being created as "/node/nid", the default method.
Reversing this commit to 8.4.x tree causes my nodes created via REST to be created with the correct URL alias pattern.
Comment #26
berdir@karenan: That's most likely a problem in combination with pathauto module because the autoloading conflicts with the customized flag it adds there.
If you also add pathauto => FALSE inside path then it probably works again.
Comment #27
karenann commentedUnfortunately, I can't wrap my brain around how to implement the suggestion @berdir has made. I will gladly accept any additional guidance.
In any event, I appreciate the advice! Thanks!
Comment #28
berdirMaybe I misunderstood? You want to have the default generated alias and don't explicitly send an alias?
Either way, I'd recommend you open a bug report in pathauto, I'll try to have a look at it there. A test case or so would be extremely useful in helping to debug and fix this and makes it much more likely that I'll find time to look into it.