Problem/Motivation

Port the freelinking_prepopulate module to Drupal 8.

Proposed resolution

Do it.

Remaining tasks

* Write patch with tests (Status: work-in-progress)

CommentFileSizeAuthor
#33 interdiff-2921028-32-33.txt99 bytesmradcliffe
#33 freelinking-2921028-prepopulate-plugin-33.patch68.47 KBmradcliffe
#32 interdiff-2921028-30-32.txt255 bytesmradcliffe
#32 freelinking-2921028-prepopulate-plugin-32.patch68.47 KBmradcliffe
#30 interdiff-2921028-28-30.txt11.56 KBmradcliffe
#30 freelinking-2921028-prepopulate-plugin-30.patch68.18 KBmradcliffe
#28 interdiff-2921028-26-28.txt252 bytesmradcliffe
#28 freelinking-2921028-prepopulate-plugin-28.patch61.57 KBmradcliffe
#26 interdiff-2921028-24-26.txt1.28 KBmradcliffe
#26 freelinking-2921028-prepopulate-plugin-26.patch61.28 KBmradcliffe
#24 freelinking-2921028-prepopulate-plugin-24.patch62.63 KBmradcliffe
#24 interdiff-2921028-22-24.txt548 bytesmradcliffe
#22 interdiff-2921028-20-22.txt572 bytesmradcliffe
#22 freelinking-2921028-prepopulate-plugin-22.patch62.63 KBmradcliffe
#20 freelinking-2921028-prepopulate-plugin-20.patch62.65 KBmradcliffe
#20 interdiff-2921028-18-20.txt1.47 KBmradcliffe
#18 interdiff-2921028-15-18.txt789 bytesmradcliffe
#18 freelinking-2921028-prepopulate-plugin-18.patch61.57 KBmradcliffe
#15 interdiff-2921028-11-15.patch664 bytesmradcliffe
#15 freelinking-2921028-prepopulate-plugin-15.patch61.67 KBmradcliffe
#11 interdiff-2921028-9-11.txt10.67 KBmradcliffe
#11 freelinking-2921028-prepopulate-plugin-11.patch61.58 KBmradcliffe
#10 interdiff-2921028-6-9.txt3.39 KBmradcliffe
#10 freelinking-2921028-prepopulate-plugin-9.patch53.55 KBmradcliffe
#6 freelinking-2921028-prepopulate-plugin-6.patch52.96 KBmradcliffe
#6 interdiff-2921028-4-6.txt585 bytesmradcliffe
#4 interdiff-2921028-3-4.txt5.21 KBmradcliffe
#4 freelinking-2921028-prepopulate-plugin-4.patch52.55 KBmradcliffe
#3 freelinking-2921028-prepopulate-plugin-3.patch48.44 KBmradcliffe
#3 interdiff-2921028-2-3.txt28.75 KBmradcliffe
#2 freelinking-2921028-prepopulate-plugin-2.patch26.34 KBmradcliffe

Comments

mradcliffe created an issue. See original summary.

mradcliffe’s picture

Work-in-progress patch.

mradcliffe’s picture

Status: Active » Needs review
StatusFileSize
new28.75 KB
new48.44 KB

Needed 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.

mradcliffe’s picture

Added some code standard cleanup in this patch.

Status: Needs review » Needs work

The last submitted patch, 4: freelinking-2921028-prepopulate-plugin-4.patch, failed testing. View results

mradcliffe’s picture

Status: Needs work » Needs review
StatusFileSize
new585 bytes
new52.96 KB

Of course the standards checker only highlighted the interface and not the class :|

Status: Needs review » Needs work

The last submitted patch, 6: freelinking-2921028-prepopulate-plugin-6.patch, failed testing. View results

mradcliffe’s picture

Issue tags: +Needs tests

Manual testing:

1. Settings pages throwing warnings.

 	php 	07/25/2018 - 15:38 	Notice: Undefined index: default_node_type in Drupal\… 	admin 	
	php 	07/25/2018 - 15:38 	Notice: Undefined index: failover in Drupal\… 	admin 	
	php 	07/25/2018 - 15:37 	Notice: Undefined index: default_node_type in Drupal\… 	admin 	
	php 	07/25/2018 - 15:37 	Notice: Undefined index: failover in Drupal\… 	admin 	
	php 	07/25/2018 - 15:37 	Notice: Undefined index: default_node_type in Drupal\… 	admin 	
	php 	07/25/2018 - 15:37 	Notice: Undefined index: failover in Drupal\… 	admin

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.

mradcliffe’s picture

Status: Needs work » Needs review

Work-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.

mradcliffe’s picture

Maybe upload a patch too?

mradcliffe’s picture

Issue tags: -Needs tests
StatusFileSize
new61.58 KB
new10.67 KB

Okay, 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?

mradcliffe’s picture

Status: Needs review » Needs work

The last submitted patch, 11: freelinking-2921028-prepopulate-plugin-11.patch, failed testing. View results

mradcliffe’s picture

Status: Needs work » Needs review
StatusFileSize
new61.67 KB
new664 bytes

Whoops, phpstorm adds @package and I forgot to change it to @group. :(

Status: Needs review » Needs work

The last submitted patch, 15: interdiff-2921028-11-15.patch, failed testing. View results

mradcliffe’s picture

Well, 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 :|

mradcliffe’s picture

Status: Needs work » Needs review
StatusFileSize
new61.57 KB
new789 bytes

Maybe 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.

Status: Needs review » Needs work

The last submitted patch, 18: freelinking-2921028-prepopulate-plugin-18.patch, failed testing. View results

mradcliffe’s picture

Status: Needs work » Needs review
StatusFileSize
new1.47 KB
new62.65 KB

Oh, 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.

Status: Needs review » Needs work

The last submitted patch, 20: freelinking-2921028-prepopulate-plugin-20.patch, failed testing. View results

mradcliffe’s picture

Status: Needs work » Needs review
StatusFileSize
new62.63 KB
new572 bytes

Should have the correct composer require now.

Status: Needs review » Needs work

The last submitted patch, 22: freelinking-2921028-prepopulate-plugin-22.patch, failed testing. View results

mradcliffe’s picture

Status: Needs work » Needs review
StatusFileSize
new548 bytes
new62.63 KB

Trying different composer version spec.

Status: Needs review » Needs work

The last submitted patch, 24: freelinking-2921028-prepopulate-plugin-24.patch, failed testing. View results

mradcliffe’s picture

Status: Needs work » Needs review
StatusFileSize
new61.28 KB
new1.28 KB

Forgot to remove drupalci.yml file from the last patch. Removed.

Status: Needs review » Needs work

The last submitted patch, 26: freelinking-2921028-prepopulate-plugin-26.patch, failed testing. View results

mradcliffe’s picture

Status: Needs work » Needs review
StatusFileSize
new61.57 KB
new252 bytes

Adds prepopulate as dev requirement to composer.json.

Status: Needs review » Needs work

The last submitted patch, 28: freelinking-2921028-prepopulate-plugin-28.patch, failed testing. View results

mradcliffe’s picture

Status: Needs work » Needs review
StatusFileSize
new68.18 KB
new11.56 KB

Should 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.

Status: Needs review » Needs work

The last submitted patch, 30: freelinking-2921028-prepopulate-plugin-30.patch, failed testing. View results

mradcliffe’s picture

Status: Needs work » Needs review
StatusFileSize
new68.47 KB
new255 bytes

Woops, forgot I was working on a different computer.

mradcliffe’s picture

The last submitted patch, 32: freelinking-2921028-prepopulate-plugin-32.patch, failed testing. View results

  • mradcliffe committed 42ecfb2 on 8.x-3.x
    Issue #2921028 by mradcliffe, alonaoneill: Updates...
mradcliffe’s picture

Status: Needs review » Fixed

Fixed up phpunit.xml.dist and freelinking.info.yml on patch and commit

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.