Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rfay’s picture

Excellent... However, first the Field Example will have to be ported to D8 to begin with. It's OK if this issue prompts that, as long as things have stabilized enough.

Mile23’s picture

We've got #1229322: hook_field_access example/explanation and #1293104: 3text field validation fundamentally flawed in the way.

I'm poking around on the former.

I'd say we need to wait until at least feature freeze on D8 before making examples. Unless of course any of the D8 devs want to start the ball rolling on their respective APIs. :-)

Mile23’s picture

Marking as postponed for now: #1861598: Examples for Drupal 8 needs relatively stable feature set

Please continue development and discussion as desired.

Mile23’s picture

Status: Active » Postponed
Mile23’s picture

Status: Postponed » Needs work
kerasai’s picture

Title: Convert field example widgets to the new plugin system » D8 Port: field_examples
Status: Needs work » Needs review
Issue tags: +D8CX
FileSize
16.04 KB

Hi folks,

Attached it is a first shot at field_examples implemented in D8. It'a pretty much just a straight port of the D7 functionality in the shiny, new D8 ecosystem. This should be pretty close, please take a look and provide feedback.

Things that definitely still need to be addressed:

  1. I'm not real clear on how the schema delcaration in field_example.schema.yml is supposed to be. It works, but I'm not very confident that it's right.
  2. Doc blocks need updating. I started, but realized I wasn't up for rewriting the big chunk in the .module file right now. Formatters and widgets should be easy.

Also, I'm pushing into a repo on Github for my own convenience. https://github.com/kerasai/drupal-examples/tree/8.x-1.x-field_example if anyone is interested.

kerasai’s picture

Title: D8 Port: field_examples » D8 Port: field_example
FileSize
2.19 KB
17.88 KB

Forgot to add in the page that the module provided which had some info about the example. Now included.

marvil07’s picture

Assigned: Unassigned » marvil07
Status: Needs review » Needs work

Patch does not contains the original test.

Following a patch adding them, not finished tough.

Also, based on not having the test, I would suggest to do a full review comparing with D7 version.

marvil07’s picture

Assigned: marvil07 » Unassigned
Status: Needs work » Needs review
FileSize
8.65 KB

New changes on this commit patch:

  • Remove hook_menu in favor or routing.
  • Re-add test class
  • Routing uses now path instead of pattern as key(see core's 7cfa38d01ad6f7ec747e1a2f77dc53b07679398c).
  • Follow core drupalPost rename for forms (see core's d009cac09c57f6d7e37a5d20aa87676fab959210).
  • minor initial changes to test.
marvil07’s picture

Sorry I added the wrong patch, last one was the interdiff.

Re-uploading what is mentioned on last comment.

Status: Needs review » Needs work

The last submitted patch, 9: examples.field-example.1796606-9.patch, failed testing.

Enxebre’s picture

Hi,
Renaming folders according core modules (FieldFormatter, FieldWidget, FieldType )
Fixing values passed to viewElements method.
Fixing use of wrong namespaces
Using \Drupal::formBuilder()->setValue and \Drupal::formBuilder()->setError instead of old deprecated functions.

Enxebre’s picture

Status: Needs work » Needs review

The last submitted patch, 12: examples.field-example.1796606-12.patch, failed testing.

The last submitted patch, 12: examples.field-example.1796606-12.patch, failed testing.

Enxebre’s picture

Assigned: Unassigned » Enxebre
Mile23’s picture

Issue summary: View changes
Mile23’s picture

FileSize
5.73 KB
24.28 KB

This patch (mostly) works in the UI now. The tests still don't pass, and I assume the validation routines are still not happening.

Status: Needs review » Needs work

The last submitted patch, 18: 1796606_18.patch, failed testing.

The last submitted patch, 18: 1796606_18.patch, failed testing.

spiffl’s picture

made some changes to make it work on alpha10.

spiffl’s picture

Assigned: Enxebre » spiffl
Status: Needs work » Needs review
FileSize
32.87 KB
24.75 KB

fixed the issue in colorpicker that the jquery-class-name was not assigned anymore and cleanup up coding standard errors.

Status: Needs review » Needs work

The last submitted patch, 22: interdiff-1796606-18-22.patch, failed testing.

The last submitted patch, 22: 1796606_22.patch, failed testing.

spiffl’s picture

Status: Needs work » Needs review
FileSize
33.05 KB
25.08 KB

incorporated latest API Changes from drupal HEAD + moved comon test-baseclass outsite the Tests-namespace

Status: Needs review » Needs work

The last submitted patch, 25: interdiff-1796606-18-23.patch, failed testing.

spiffl’s picture

Assigned: spiffl » Unassigned
Status: Needs work » Needs review

examples-field_example-1796606-23.patch is ready for a review

The last submitted patch, 21: examples-adapttoalpha10-1796606-21.patch, failed testing.

Mile23’s picture

If you name your interdiff with .txt as the extension, the testbot will ignore it.

  1. +++ b/field_example/field_example.module
    @@ -0,0 +1,125 @@
    + * - Defining a formatter for the field (the portion that outputs the field for
    + *   display):
    + *   - hook_field_formatter_info()
    + *   - hook_field_formatter_view()
    + *
    + * - Defining a widget for the edit form:
    + *   - hook_field_widget_info()
    + *   - hook_field_widget_form()
    

    Seems like the documentation is still out of date...

  2. +++ b/field_example/field_example.module
    @@ -0,0 +1,125 @@
    + * Implements hook_menu().
    

    See: #2223291: Change all hook_menu() implementations to *.menu_links.yml files, add tests

Mile23’s picture

Status: Needs review » Needs work
spiffl’s picture

Status: Needs work » Needs review
FileSize
33.58 KB

Both points from #29 are now adapted + both validate functions are now moved to the Widget classes.

spiffl’s picture

Status: Needs review » Needs work

The last submitted patch, 31: examples-field_example-1796606-31.patch, failed testing.

Mile23’s picture

Status: Needs work » Needs review
Mile23’s picture

FileSize
30.06 KB
55.31 KB

PSR-4, coding standards... interdiff from #31.

This is pretty close.

  • Commit 41768a8 on 8.x-1.x authored by kerasai, committed by Mile23:
    Issue #1796606 by spiffl, Mile23, marvil07, kerasai, Enxebre | linclark...
Mile23’s picture

Status: Needs review » Fixed

Committed! http://cgit.drupalcode.org/examples/commit/?h=8.x-1.x&id=41768a807882f7e...

Thanks, everyone, and especially kerasai for getting the ball rolling.

Status: Fixed » Closed (fixed)

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