Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi there, It would be nice to have a method "generateSampleValue" for the class RgbItem which may allow the user to see valid random values for this field with Devel Generate.
Comment | File | Size | Author |
---|---|---|---|
#14 | examples-field_example_generate_sample_value-2373511-14.patch | 3.92 KB | navneet0693 |
| |||
#5 | examples-field_example_generate_sample_value-2373511.patch | 3.46 KB | mnico |
#1 | new_method_rgbitem-2373511.patch | 548 bytes | mnico |
Comments
Comment #1
mnico CreditAttribution: mnico commentedThe patch to add this method.
Comment #2
Mile23Devel is a contrib module, and Examples doesn't support contrib APIs, only core APIs. The goal of field_example is to show people how to implement a field using core APIs, and this is out of scope.
Thanks, but I'm going to have to say no on this one.
Comment #3
mnico CreditAttribution: mnico commentedI understand but this method exists in the core (https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Field%21F...).
Maybe I was wrong in mentioning the Devel module.
Comment #4
Mile23Oh, hah. :-) Sorry.
So this misunderstanding tells us: Needs docs explaining what this method does and what other systems use it, such as devel. Put them in the docblock after the {@inheritdoc}.
It also needs a test to tell us that the value it returns can be used in an RgbItem field. So a test which does the following: 1) Create a content type, 2) Attach the field to the content type, 3) Save a piece of content using the sample value.
Thanks.
Comment #5
mnico CreditAttribution: mnico commentedHi, i attached a patch with the test and the right way to implement the generateSampleValue method.
Comment #8
mnico CreditAttribution: mnico commentedHello, the test failed for another example module (js_example). It is necessary to work on this?
regards
Comment #9
Mile23Sorry, I wanted to trigger a branch blocker.
Sit tight. :-)
Comment #12
Mile23More testbot issues, and we're using this patch to figure it out. Sorry if you're getting a lot of notices about it.
Comment #13
Mile23Re-running the test.
Comment #14
navneet0693 CreditAttribution: navneet0693 as a volunteer and at QED42 commentedRe-rolled and changed test to KTB.
Comment #15
Mile23Whitespace errors.
Deprecated functions. Wow this issue is way too old. I feel bad now.