Closed (fixed)
Project:
Freelinking
Version:
8.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
4 Nov 2017 at 17:04 UTC
Updated:
26 Jan 2019 at 14:49 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
mradcliffeWork-in-progress patch.
Comment #3
mradcliffeNeeded an API change in freelinking manager interface to pass in failover plugin settings.
This should pass regression tests, but still need new tests for freelinking_prepopulate itself.
Still todo:
- allowing custom fields.
Comment #4
mradcliffeAdded some code standard cleanup in this patch.
Comment #6
mradcliffeOf course the standards checker only highlighted the interface and not the class :|
Comment #8
mradcliffeManual testing:
1. Settings pages throwing warnings.
2. The page title is not added to the link text.
The "text", "bundle" or "type" keys are not being added to $target when I use the example
[[create:blah]]. Should be an easy fix as I just took from the drupal 7 version verbatim instead of changing it to work.Comment #9
mradcliffeWork-in-progress patch. No tests yet.
It looks like prepopulate may be changing to better support Entity API in #2849432: Simplify Prepopulate implementation with the Entity API so I'm not sure if we can support fields at all until prepopulate is stable. It wasn't working for me at all with
[[create:Blah|Blah|Create a blah|type=article|body=Some article|field_tags=tag1,tag2,tag3]], which with the current patch expands to<a href="/node/add/article?edit[title]=Blah&edit[body][0][value]=%22Some%20article%22&edit[field_tags][0][target_id]=%22tag1%2C%20tag2%2C%20tag3%22" title="Links to a prepopulated node/add form.">Blah</a>. The link itself works and fills in the title.Comment #10
mradcliffeMaybe upload a patch too?
Comment #11
mradcliffeOkay, figured out prepopulate by stepping through the code because the documentation is in shambles for the latest dev release.
This code isn't perfect. We'll need to figure out the widget instead of just going by storage definition.
I added a test to assert the expected link hrefs.
I Also found some issues with the plugin implementation for freelinking plugins. Arrays are not merging correctly so we're getting empty defaults. Tests have revealed this?
Comment #13
mradcliffeComment #15
mradcliffeWhoops, phpstorm adds @package and I forgot to change it to @group. :(
Comment #17
mradcliffeWell, it needs work anyway.
I'm not sure how terrible this is going to be, but based on how the array parents work, instead of looking at storage definition we need to look at the entity form display, get the widget for the field (if it's not hidden), and then figure out the array parents.
Entity reference autocomplete tags has "tags[widget][target_id]" for instance, but text fields are title[widget][0][value]. And whatever else exists. It's so much more complex than just being able to derive it from the markup like in Drupal 7 :|
Comment #18
mradcliffeMaybe we need a custom drupalci.yml instead of using test_dependencies in the main module? Not sure if this is going to get read in a patch though so I may need to commit it separately.
Comment #20
mradcliffeOh, it did include it, but didn't run any tests because that's what I apparently told it to do?
I guess it's not additive, but a full replacement. Let's try that.
Comment #22
mradcliffeShould have the correct composer require now.
Comment #24
mradcliffeTrying different composer version spec.
Comment #26
mradcliffeForgot to remove drupalci.yml file from the last patch. Removed.
Comment #28
mradcliffeAdds prepopulate as dev requirement to composer.json.
Comment #30
mradcliffeShould fix the tests.
I'm finding that field_tags doesn't work, and this looks like a bug in prepopulate that I'm working on a test to prove.
I think this is fairly close, and maybe a good idea to commit and then roll an alpha? I'm a bit concerned about the security of caching of prepopulate links so that needs some more manual testing/review.
Comment #32
mradcliffeWoops, forgot I was working on a different computer.
Comment #33
mradcliffeWelp.
Comment #36
mradcliffeFixed up phpunit.xml.dist and freelinking.info.yml on patch and commit