Deprecate \Drupal\Core\Field\FieldItemBase::generateSampleValue

Created on 25 April 2017, almost 8 years ago
Updated 16 March 2023, almost 2 years ago

Problem/Motivation

@lauriii discovered this in #2802541: Timestamp field type doesn't provide sample values .

\Drupal\Core\Field\FieldItemBase::generateSampleValue() is odd - it is an empty function which does not generate a sample value. We should deprecate it ( https://www.drupal.org/node/2856615 ) and remove it in Drupal 9 so that all field types have to implement it.

Sine the method is documented to

   * @return array
   *   An associative array of values.

Fixing this is a bug.

Proposed resolution

As above.

Remaining tasks

User interface changes

None

API changes

None - this method is part of the interface which allegedly does:

   * @return array
   *   An associative array of values.

But this default implementation does not.

Data model changes

None

📌 Task
Status

Needs work

Version

10.1

Component
Field 

Last updated 1 day ago

Created by

🇬🇧United Kingdom alexpott 🇪🇺🌍

Live updates comments and jobs are added and updated live.
  • Needs subsystem maintainer review

    It is used to alert the maintainer(s) of a particular core subsystem that an issue significantly impacts their subsystem, and their signoff is needed (see the governance policy draft for more information). Also, if you use this tag, make sure the issue component is set to the correct subsystem. If an issue significantly impacts more than one subsystem, use needs framework manager review instead.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇳India prem suthar Ahemdabad- Gujrat , Jodhpur - Rajsthan

    Added The patch For 10.1 And Addressed The #29 Comment .

  • Status changed to Needs review almost 2 years ago
  • 🇮🇳India Abhisheksingh27

    Adding updated #31 patch after fixing custom commands failure

  • 🇮🇳India amanshukla6158

    removing deprecated constant REQUEST_TIME

  • Status changed to Needs work almost 2 years ago
  • 🇺🇸United States smustgrave

    Hitting the reset. #33 is adding changes not in the original patch. I'm hiding all the patches next reroll should start from #12 while also addressing #29.

    Updating credit as it is expected to change your patch before uploading. Can run ./core/scripts/dev/commit-code-check.sh before uploading a patch to make sure there are no issues with code formatting. see https://www.drupal.org/docs/develop/development-tools/running-core-devel...

    =====

    Just FYI to help get the message out there.

    Starting March 2023, simple rerolls, rebases, or merges will no longer receive issue credit. Only rerolls that address a merge conflict will be credited, and the merge conflict that was resolved must be documented in the text of an issue comment.

    Example
    error: patch failed: core/modules/system/tests/modules/twig_theme_test/twig_theme_test.module:77
    error: core/modules/system/tests/modules/twig_theme_test/twig_theme_test.module: patch does not apply

    To receive credit for contributing to this issue, assist with other outstanding tasks or unaddressed feedback.
    See the issue credit guidelines for more information.

Production build 0.71.5 2024