Closed (duplicate)
Project:
Drupal core
Version:
8.0.x-dev
Component:
link.module
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
20 Oct 2014 at 14:00 UTC
Updated:
30 Jan 2015 at 03:32 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
webflo commentedComment #2
webflo commentedComment #3
marthinal commentedComment #5
marthinal commentedIt works testing manually and the 2 fails are fixed. Let's take a look at the results again...
Comment #6
marthinal commented#5 looks good but this test should fail. Locally this test works.
Comment #7
marthinal commentedThe test is correct... we're editing and the bug appears on "view". I was trying with an entity user and the bug appears too.
Comment #8
marthinal commentedComment #9
marthinal commentedAdded test + patch.
Comment #11
marthinal commentedComment #12
yesct commentedthis might actually be critical.
--
why are all internal links non-empty?
Comment #13
pwolanin commentedWhy should
$value['url']be populated at all if you have found a route?Comment #14
yesct commentedComment #15
yesct commentedregarding #12, it passes without that if.
Comment #16
marthinal commented@pwolanin in the comment I see that we "Reset the URL value to contain only the path." I was checking and when adding for example "node/add" as a link, we receive "/node/add" so we remove the first "/".
The test reproduce the bug and the bug is fixed by the patch so looks good. :)
Comment #17
dawehnerNote: This kinda does similiar things as #2235457: Use link field for shortcut entity is doing, but this is already. Just wanting to raise awareness.
Can we please get rid of the $url->toArray() call? It doesn't buy as that much and is rather confusing ... this used to work for us, but it changed its internal behaviour.
Comment #18
alexpottThis is testing our test data. We should be loading the entity and seeing that the field's value is a value route with parameters for internal paths. Also, afaics, $value here is always a path not a route.
Comment #19
marthinal commented#17 @dawehner At least we need "options". removed toArray() method.
#18 @alexpott I think maybe it is enough checking if the link exists when we go to the node
Thanks for the revision.
Comment #21
mac_weber commentedIn the latest -dev core build it is not possible to save nodes with internal links via the UI.
This patch fixes it.
#18 @alexpott I agree with @marthinal at #19. Any reason for testing the route?
Comment #22
pwolanin commentedI still question whether this should be removed or changed when there is a route:
In general you shouldn't be storing the rendered URL
Comment #23
alexpott#22 needs to be answered before we can commit this.
Comment #24
mac_weber commented@pwolanin I have done tests locally and I think you are right. We don't need to store the URL when there is a route, then I have removed that line.
Comment #25
maijs commentedThis issue seems to be closely related to another issue: #2300161: Link field URL textfield is populated with a fully generated URL in entity edit form if internal URL is used as a field value
1. First of all I agree with everyone who expressed an opinion that URL should not be used for internal paths. It's worth noting that
urlvalue will still be stored in field storage unless it's set to NULL.2. It's also worth mentioning that none of the patches in this issue address the problem with internal path not being properly populated in the widget when entity is edited. As it's stated in #2300161: Link field URL textfield is populated with a fully generated URL in entity edit form if internal URL is used as a field value:
In order to avoid that, URL value for the link field needs to be processed and:
<front>,<none>or<current>.3. Current tests do not test for validity of special internal paths (e.g.
<front>). I added<front>to the list of valid internal paths to the tests.Comment #26
dawehnerIt is sad that we have to support it ...
Afaik you can achieve the same thing when you set
$options['alias'] = TRUE;Comment #27
maijs commented@dawehner, thanks for the tip. Implemented.
Comment #28
pwolanin commentedDo we want to re-resolve the route at render time or otherwise work harder to retain the user input?
Comment #29
pwolanin commentedi.e. maybe postpone for this discussion: #2346189: Denormalizing paths into route names/parameters is brittle / broken
Comment #30
dawehnerGiven that we talk here about a bug-fix only issue I would argue that this should be worked on.
It is a problem which exists out there already.
Comment #31
maijs commentedlinkmodule is not usable at all for internal links without this patch, so regardless of what's the outcome of discussion in #2346189: Denormalizing paths into route names/parameters is brittle / broken this bug needs to be fixed.Comment #32
dawehnerYeah I have to agree, we want to add it know, and if just to have that tiny little bit more of test coverage we have to be aware of in the future.
Comment #33
pwolanin commentedThe solution based on #2407505: [meta] Finalize the menu links (and other user-entered paths) system that we should process the internal path at render time, and not try to store a route.
Comment #34
dawehnerAt that given point in time, this is a duplicate of #2406749: Use a link field for custom menu link