With #1742734: [META] Widgets as Plugins, field widgets are now handled using the plugin system. The field example widget definition should be changed to reflect this.

Relevant change notices:

https://drupal.org/node/2064123
https://drupal.org/node/1805846
https://drupal.org/node/1796000

Files: 
CommentFileSizeAuthor
#35 interdiff.txt55.31 KBMile23
#35 1796606_35.patch30.06 KBMile23
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 724 pass(es).
[ View ]
#31 examples-field_example-1796606-31.patch33.58 KBspiffl
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 578 pass(es).
[ View ]
#21 examples-adapttoalpha10-1796606-21.patch30.41 KBspiffl
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 536 pass(es), 51 fail(s), and 10 exception(s).
[ View ]
#18 1796606_18.patch24.28 KBMile23
FAILED: [[SimpleTest]]: [MySQL] 223 pass(es), 44 fail(s), and 1 exception(s).
[ View ]
#18 interdiff.txt5.73 KBMile23
#12 interdiff.1796606-10-12.txt48.32 KBEnxebre
#12 examples.field-example.1796606-12.patch23.97 KBEnxebre
FAILED: [[SimpleTest]]: [MySQL] 223 pass(es), 44 fail(s), and 1 exception(s).
[ View ]
#10 examples.field-example.1796606-9.patch24.33 KBmarvil07
FAILED: [[SimpleTest]]: [MySQL] 173 pass(es), 44 fail(s), and 1 exception(s).
[ View ]
#10 interdiff.txt8.65 KBmarvil07
#9 examples.field-example.1796606-9.patch8.65 KBmarvil07
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch examples.field-example.1796606-9.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#7 examples.field-example.1796606-7.patch17.88 KBkerasai
PASSED: [[SimpleTest]]: [MySQL] 165 pass(es).
[ View ]
#7 interdiff.txt2.19 KBkerasai
#6 examples.field-example.1796606-6.patch16.04 KBkerasai
FAILED: [[SimpleTest]]: [MySQL] 164 pass(es), 1 fail(s), and 0 exception(s).
[ View ]

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
StatusFileSize
new16.04 KB
FAILED: [[SimpleTest]]: [MySQL] 164 pass(es), 1 fail(s), and 0 exception(s).
[ View ]

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
StatusFileSize
new2.19 KB
new17.88 KB
PASSED: [[SimpleTest]]: [MySQL] 165 pass(es).
[ View ]

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
StatusFileSize
new8.65 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch examples.field-example.1796606-9.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

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

StatusFileSize
new8.65 KB
new24.33 KB
FAILED: [[SimpleTest]]: [MySQL] 173 pass(es), 44 fail(s), and 1 exception(s).
[ View ]

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

Issue summary:View changes
StatusFileSize
new23.97 KB
FAILED: [[SimpleTest]]: [MySQL] 223 pass(es), 44 fail(s), and 1 exception(s).
[ View ]
new48.32 KB

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

StatusFileSize
new5.73 KB
new24.28 KB
FAILED: [[SimpleTest]]: [MySQL] 223 pass(es), 44 fail(s), and 1 exception(s).
[ View ]

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

StatusFileSize
new30.41 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 536 pass(es), 51 fail(s), and 10 exception(s).
[ View ]

made some changes to make it work on alpha10.

spiffl’s picture

Assigned:Enxebre» spiffl
Status:Needs work» Needs review
StatusFileSize
new32.87 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 536 pass(es), 51 fail(s), and 10 exception(s).
[ View ]
new24.75 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Unable to apply patch interdiff-1796606-18-22.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

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
StatusFileSize
new33.05 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 570 pass(es).
[ View ]
new25.08 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Unable to apply patch interdiff-1796606-18-23.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

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
StatusFileSize
new33.58 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 578 pass(es).
[ View ]

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

StatusFileSize
new30.06 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 724 pass(es).
[ View ]
new55.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.