Add generateSampleValue() to RgbItem [#2373511] | Drupal.org
Skip to search
Can we use first and third party cookies and web beacons to
understand our audience, and to tailor promotions you see
Add generateSampleValue() to RgbItem
Closed (fixed)
Project:
Examples for Developers
Version:
4.0.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
mnico
Created:
11 Nov 2014 at 21:51 UTC
Updated:
21 Apr 2026 at 01:25 UTC
Jump to comment:
Most recent
Most recent file
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
Issue fork
examples-2373511
Show commands
Start within a Git clone of the project using the
version control instructions
Add & fetch this issue fork’s repository
Or,
if you do not have
SSH keys set up on git.drupalcode.org
Add & fetch this issue fork’s repository
2373511-add-the-method
plain diff
MR
!103
Check out this branch for the first time
Check out existing branch, if you already have it locally
About issue forks
Comments
Comment
#1
mnico
commented
11 November 2014 at 21:55
Status:
Active
» Needs review
Status
File
Size
new
new_method_rgbitem-2373511.patch
548 bytes
The patch to add this method.
or
to post comments
Comment
#2
mile23
Seattle, WA
commented
12 November 2014 at 03:25
Status:
Needs review
» Closed (won't fix)
Devel 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.
or
to post comments
Comment
#3
mnico
commented
12 November 2014 at 03:33
I understand but this method exists in the core (
).
Maybe I was wrong in mentioning the Devel module.
or
to post comments
Comment
#4
mile23
Seattle, WA
commented
12 November 2014 at 04:10
Status:
Closed (won't fix)
» Needs work
Oh, 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.
or
to post comments
Comment
#5
mnico
commented
12 November 2014 at 17:59
Status:
Needs work
» Needs review
Status
File
Size
new
examples-field_example_generate_sample_value-2373511.patch
3.46 KB
Hi, i attached a patch with the test and the right way to implement the generateSampleValue method.
or
to post comments
Comment
#6
12 December 2014 at 01:28
Mile23
queued
5: examples-field_example_generate_sample_value-2373511.patch
for re-testing.
or
to post comments
Comment
#7
12 December 2014 at 01:32
Status:
Needs review
» Needs work
The last submitted patch,
5: examples-field_example_generate_sample_value-2373511.patch
, failed testing.
or
to post comments
Comment
#8
mnico
commented
12 December 2014 at 13:43
Hello, the test failed for another example module (js_example). It is necessary to work on this?
regards
or
to post comments
Comment
#9
mile23
Seattle, WA
commented
13 December 2014 at 21:48
Sorry, I wanted to trigger a branch blocker.
Sit tight. :-)
or
to post comments
Comment
#10
15 December 2014 at 18:06
Status:
Needs work
» Needs review
Mile23
queued
5: examples-field_example_generate_sample_value-2373511.patch
for re-testing.
or
to post comments
Comment
#11
15 December 2014 at 18:17
Status:
Needs review
» Needs work
The last submitted patch,
5: examples-field_example_generate_sample_value-2373511.patch
, failed testing.
or
to post comments
Comment
#12
mile23
Seattle, WA
commented
15 December 2014 at 18:18
More testbot issues, and we're using this patch to figure it out. Sorry if you're getting a lot of notices about it.
or
to post comments
Comment
#13
mile23
Seattle, WA
commented
2 July 2017 at 18:40
Re-running the test.
or
to post comments
Comment
#14
navneet0693
commented
18 July 2017 at 09:51
Status:
Needs work
» Needs review
Status
File
Size
new
examples-field_example_generate_sample_value-2373511-14.patch
3.92 KB
Re-rolled and changed test to KTB.
or
to post comments
Comment
#15
mile23
Seattle, WA
commented
23 March 2018 at 19:38
Status:
Needs review
» Needs work
$ git apply examples-field_example_generate_sample_value-2373511-14.patch
examples-field_example_generate_sample_value-2373511-14.patch:26: trailing whitespace.
examples-field_example_generate_sample_value-2373511-14.patch:63: trailing whitespace.
examples-field_example_generate_sample_value-2373511-14.patch:87: trailing whitespace.
examples-field_example_generate_sample_value-2373511-14.patch:95: trailing whitespace.
examples-field_example_generate_sample_value-2373511-14.patch:100: trailing whitespace.
warning: squelched 1 whitespace error
warning: 6 lines add whitespace errors.
Whitespace errors.
+++ b/field_example/tests/src/Kernel/RgbItemTest.php
@@ -0,0 +1,75 @@
+ entity_create('field_storage_config', array(
...
+ entity_create('field_config', array(
...
+ $entity = entity_create('entity_test');
...
+ $entity = entity_load('entity_test', $id);
...
+ $entity = entity_load('entity_test', $id);
...
+ $entity = entity_create('entity_test');
Deprecated functions. Wow this issue is way too old. I feel bad now.
or
to post comments
Comment
#16
avpaderno
he/him
Italian
Brescia, 🇮🇹 🇪🇺
commented
2 October 2025 at 11:36
Version:
8.x-1.x-dev
» 4.0.x-dev
Component:
Field Example
» Code
Category:
Feature request
» Task
Issue tags:
Needs merge request
or
to post comments
Comment
#17
4 October 2025 at 19:29
oily
made their first commit to this issue’s fork.
or
to post comments
Comment
#18
4 October 2025 at 19:50
oily
opened
merge request !103
or
to post comments
Comment
#19
oily
commented
4 October 2025 at 19:55
Status:
Needs work
» Needs review
Issue tags:
Needs merge request
or
to post comments
Comment
#20
oily
commented
4 October 2025 at 21:17
Status:
Needs review
» Needs work
or
to post comments
Comment
#21
avpaderno
he/him
Italian
Brescia, 🇮🇹 🇪🇺
commented
5 October 2025 at 19:55
Title:
Add the method "generateSampleValue" for the class RgbItem
» Add generateSampleValue() to RgbItem
or
to post comments
Comment
#22
oily
commented
5 October 2025 at 23:26
I have manually tested the rgb colour field. I installed the examples and devel modules in a vanilla Drupal 11 site installed with the standard profile. I added the field to the article content type. I used devel to generate 50 items including articles.
Is the field supposed to be populated with sample data when devel is used? Or does that require more work so it is out of scope of this issue?
or
to post comments
Comment
#23
oily
commented
6 October 2025 at 19:41
Status:
Needs work
» Needs review
or
to post comments
Comment
#24
avpaderno
he/him
Italian
Brescia, 🇮🇹 🇪🇺
commented
6 October 2025 at 20:28
Status:
Needs review
» Reviewed & tested by the community
or
to post comments
Comment
#25
7 April 2026 at 01:19
avpaderno
committed
e6c0fe6e
on
4.0.x
authored by
oily
Issue #2373511: Add generateSampleValue() to RgbItem
or
to post comments
Comment
#26
avpaderno
he/him
Italian
Brescia, 🇮🇹 🇪🇺
commented
7 April 2026 at 01:21
Status:
Reviewed & tested by the community
» Fixed
or
to post comments
Comment
#27
7 April 2026 at 01:21
Now that this issue is closed,
review the
contribution record
As a contributor, attribute any organization that helped you, or if you volunteered your own time.
Maintainers, credit people who helped resolve this issue.
or
to post comments
Comment
#28
21 April 2026 at 01:25
Status:
Fixed
» Closed (fixed)
Automatically closed - issue fixed for 2 weeks with no activity.
or
to post comments
Contribution record
Add child issue
clone issue
Infrastructure management for Drupal.org provided by
Need a Drupal 7 extended support partner? Consider Tag1.
News items
News
Planet Drupal
Social media
Sign up for Drupal news
Security advisories
Jobs
Our community
Community
Services
Training
Hosting
Contributor guide
Groups & meetups
DrupalCon
Code of conduct
Documentation
Documentation
Drupal Guide
Drupal User Guide
Developer docs
API.Drupal.org
Drupal code base
Download & Extend
Drupal core
Modules
Themes
Distributions
Governance of community
About
Web accessibility
Drupal Association
About Drupal.org
Drupal is a
registered trademark
of
Dries Buytaert