Follow-up to #2287727: Rename FieldConfig to FieldStorageConfig

Problem/Motivation

In the past couple weeks, the Core/Field API has settled on a terminology of :

  • FieldStorageDefinition : the "shared" properties that define a storage bucket for field data, relevant for a given entity type
  • FieldDefinition : the definition of an actual field atached to an actual bundle of the above entity type

This exactly replicates the split between "field" and "field instance" that comes from D7, and that is still used for configurable fields :

  • FieldConfig is exactly what the Core/Field API uses as a FieldStorageDefinition
  • FieldInstanceConfig is exactly what the Core/Field API uses as a FieldDefinition

This terminology split produces some very confusing artifacts (var names, class hierarchy), and forces you to switch brain modes when crossing between Core/Field and field.module.

#2283977: Create a new ConfigEntity type for storing bundle-specific customizations of base fields is adding a FieldConfigBase, with

  • FieldConfig *not* extends FieldConfigBase
  • FieldInstanceConfig extends FieldConfigBase

Proposed resolution

We should bite the bullet and apply our terminology consistently :

  • what D7 called a $field is a FieldStorageDefinition
  • what D7 called an $instance is a FieldDefinition

This is not a proposal at this point, that's what HEAD does already. We just have one subpart of the system that still uses the old terminology, while the system itself uses a new terminology (with one word, "field", being used as "that part" in one case and "the other part" in the other case - making it the perfect WTF :-)

Thus :

  • FieldConfig should be renamed FieldStorageConfig
    • entity type : field_storage_config,
    • CMI names : field.storage.[entity_type].[field_name]
  • FieldInstanceConfig should be renamed FieldConfig
    • entity type : field_config,
    • CMI names : field.field.[entity_type].[bundle].[field_name]

Given we're renaming A to B and C to A, it's much saner to approach this in two successive patches :
1. Rename FieldConfig to FieldStorageConfig -- done in #2287727: Rename FieldConfig to FieldStorageConfig
2. Rename FieldInstanceConfig to FieldConfig

Current patch does 1.

API changes

- renames FieldInstanceConfig to FieldConfig
- renames FieldInstanceConfigInterface to FieldConfigInterface
- renames FieldInstanceConfigStorage to FieldConfigStorage
- renames entity type ID from 'field_instance_config' to 'field_config'
- renames CMI records from field.instance.* to field.field.*
- renames hook_field_instance_config_*() to hook_field_config_*() (hook_ENTITY_TYPE_*)
- renames FieldInstanceConfigDeleteForm to FieldConfigDeleteForm
- renames FieldInstanceEditForm to FieldEditForm
form_id : field_ui_field_instance_edit_form --> field_ui_field_edit_form
route name: field_ui.instance_edit_$entity_type_id --> field_ui.field_edit_$entity_type_id

For field types,
"settings" are renamed "storage settings",
"instance settings" are renamed "field settings"

In practice:
FieldItemInterface:
- renames defaultSetiings() to defaultStorageSettings()
- renames defaultInstanceSettings() to defaultFieldsettings()
- renames settingsForm() to storageSettingsForm()
- renames instanceSettingsForm() to fieldSettingsForm()
- renames settingsToConfigData() to storageSettingsToConfigData()
- renames instanceSettingsToConfigData() to fieldSettingsToConfigData()
- renames settingsFromConfigData() to storageSettingsFromConfigData()
- renames instanceSettingsFromConfigData() to fieldSettingsFromConfigData()

FieldTypePluginManager:
- renames getDefaultSettings() to getDefaultStorageSettings()
- renames getDefaultInstanceSettings() to getDefaultFieldSettings()

field types schema:
- field.[type].settings renamed to field.[type].storage_settings
- field.[type].instance_settings renamed to field.[type].field_settings

-----

Work happens in 2312093-rename-FieldInstanceConfig - helper issue is over at #2317047: Helper issue for #2312093: rename FieldInstanceConfig to FieldConfig

CommentFileSizeAuthor
#61 2312093-wtf.patch744 bytesandypost
#55 2312093-yched.55.patch626.24 KBalexpott
#55 further-fixes-pseudo-interdiff.txt59.21 KBalexpott
#54 interdiff.txt785 bytesswentel
#54 2312093-54.patch608.26 KBswentel
#52 2312093-52.patch607.75 KBswentel
#51 2312093-51.patch607.71 KBswentel
#48 interdiff.txt42.18 KBswentel
#48 2312093-48.patch607.72 KBswentel
#47 interdiff.txt7.34 KByched
#47 2312093-rename-FieldInstanceConfig-47.patch582.58 KByched
#46 interdiff.txt6.05 KByched
#46 2312093-rename-FieldInstanceConfig-46.patch577.9 KByched
#43 interdiff.txt7.01 KByched
#43 2312093-rename-FieldInstanceConfig-43.patch576.07 KByched
#41 interdiff.txt31.79 KByched
#41 2312093-rename-FieldInstanceConfig-41.patch572.88 KByched
#38 2312093-rename-FieldInstanceConfig-38.patch552.03 KByched
#34 interdiff.txt53.41 KByched
#34 2312093-rename-FieldInstanceConfig-34.patch554.81 KByched
#29 interdiff.txt720 bytesyched
#29 2312093-rename-FieldInstanceConfig-28.patch542.4 KByched
#25 interdiff.txt1.85 KByched
#25 2312093-rename-FieldInstanceConfig-25.patch541.7 KByched
#24 interdiff.txt58.18 KByched
#24 2312093-rename-FieldInstanceConfig-24.patch543.26 KByched
#23 2312093-23.patch494.33 KBswentel
#22 2312093-22.patch493.47 KBswentel
#21 2312093-21.patch492.91 KBswentel
#19 2312093-19.patch481.93 KBandypost
#19 interdiff.txt1.71 KBandypost
#16 2312093-16.patch481.35 KBswentel
#15 2312093-15.patch315.1 KBswentel
#13 2312093-13.patch314.94 KBswentel
#11 2317047-34.patch315.1 KBswentel
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

xjm’s picture

swentel’s picture

Assigned: Unassigned » swentel

Will start on this and aim for finish during Drupalaton next week.

yched’s picture

The final naming here is connected to the wider naming issue in #2283977: Create a new ConfigEntity type for storing bundle-specific customizations of base fields, which introduces a sister config entity type with a common interface and base class. Would be good if the names for those were consistent. I still think that FieldConfig is a valid contender here, but would be worth figuring out in the big picture.

Also, one aspect we overlooked in the 1st part of the rename (FieldConfig -> FieldStorageConfig) is about settings.
A field type class (FieldItemInterface) defines separate "settings" at a) the storage level and b) the field level. The corresponding API is still shaped in the old "$field / $instance" nomenclature :
- FieldItemInterface::defaultSettings(), FieldTypePluginManager::getDefaultSettings() = "storage settings"
- FieldItemInterface::defaultInstanceSettings(), FieldTypePluginManager::getDefaultInstanceSettings() = "field settings"

With the current rename plan, this should move to defaultSettings() + defaultStorageSettings()...

Berdir’s picture

@yched: Speaking of those settings, I noticed today that FieldInstanceConfig settings still automatically fall back to FieldStorageConfig. With the explicit separation, we should possibly no longer do that but widgets/formatters and so on should be explicit about whether they want an field definition or a field storage definition setting?

yched’s picture

@Berdir : yeah, I wondered about the "merge of settings" too, wasn't sure of the outcome...
This merge was initially made because, back then, "EntityNG fields don't have the $field / $instance split" ;-), and so for base fields all you had was a single bag of settings on the "field" object.

This assumption is stale now, but it's not clear to me where that puts us in terms of merging the settings...

effulgentsia’s picture

I agree with #5: FDI and FSDI are now linked at the API level for both configurable and nonconfigurable fields, since FDI has a getFieldStorageDefinition() method defined on it. Therefore, I think we can remove the merging of the two settings in FDI and FSDI implementations.

However, widgets and formatters usually don't need to know or care whether a setting is a field-level or storage-level setting (and sometimes the split is arbitrary because some field types define a storage-level setting that has nothing to do with storage, but is just a shortcut for "better UX if it does not vary by bundle"). So perhaps we can implement the merging within (Formatter|Widget)Base::getFieldSetting(s)() instead?

swentel’s picture

Issue summary: View changes

Added name of branch - will update summary later this week.

swentel’s picture

Issue summary: View changes
swentel’s picture

Issue summary: View changes
swentel’s picture

Issue tags: +Drupalaton 2014
swentel’s picture

Status: Active » Needs review
FileSize
315.1 KB

First time green - still need to rename variables though.

Status: Needs review » Needs work

The last submitted patch, 11: 2317047-34.patch, failed testing.

swentel’s picture

Status: Needs work » Needs review
FileSize
314.94 KB

Status: Needs review » Needs work

The last submitted patch, 13: 2312093-13.patch, failed testing.

swentel’s picture

Status: Needs work » Needs review
FileSize
315.1 KB
swentel’s picture

Assigned: swentel » Unassigned
FileSize
481.35 KB

Green, more renames, getting close. Unassigning for now, leaving tomorrow. Please use the branch if someone else takes over!

yched’s picture

W00t! Thanks @swentel!

Didn't review atm, just a note for now: #3 and "settings / instance_settings" also means renaming the config schema entries : field.[field_type].settings / field.[field_type].instance_settings :-/

swentel’s picture

@yched config schema has been renamed as well :) - luckily that was an easy search and replace - the hardest part are all occurences in comments and variable names.

However, I did one thing different: defaultInstanceSettings() -> defaultFieldSettings() - overlooked 3
But this should be an easy re-rename though :)

andypost’s picture

FileSize
1.71 KB
481.93 KB

re-rolled and pushed to sandbox.

1) Let's move bikeshed about settings merge to separate issue, #3 suggests to rename
FieldItemInterface::defaultSettings() to defaultStorageSettings()
but patch does only FieldItemInterface::defaultInstanceSettings() to ::defaultFieldSettings()
and I think that's enough because defaultSettings() are related to FieldType definition that currently used without storage

2) Seems we need another follow-up to clean-up test messages

+++ b/core/modules/comment/src/Tests/CommentNodeChangesTest.php
@@ -28,10 +28,10 @@ function testNodeDeletion() {
     $this->assertNotNull(entity_load('field_storage_config', 'node.comment'), 'Comment field exists');
-    $this->assertNotNull(entity_load('field_instance_config', 'node.article.comment'), 'Comment instance exists');
+    $this->assertNotNull(entity_load('field_config', 'node.article.comment'), 'Comment instance exists');
...
     $this->assertNull(entity_load('field_storage_config', 'node.comment'), 'Comment field deleted');
-    $this->assertNull(entity_load('field_instance_config', 'node.article.comment'), 'Comment instance deleted');
+    $this->assertNull(entity_load('field_config', 'node.article.comment'), 'Comment instance deleted');

some strings already affected in the patch but let's decide the reasons to clean-up 'em in the patch or not!

3) I found that there's still 2 todo with link #2116341: Apply defaults to definition objects

+++ b/core/lib/Drupal/Core/Field/BaseFieldDefinition.php
@@ -62,7 +62,7 @@ public static function create($type) {
  public static function create($type) {
    $field_definition = new static(array());
    $field_definition->type = $type;
    $field_definition->itemDefinition = FieldItemDataDefinition::create($field_definition);
    // Create a definition for the items, and initialize it with the default
    // settings for the field type.
    // @todo Cleanup in https://drupal.org/node/2116341.
    $field_type_manager = \Drupal::service('plugin.manager.field.field_type');
-    $default_settings = $field_type_manager->getDefaultSettings($type) + $field_type_manager->getDefaultInstanceSettings($type);
+    $default_settings = $field_type_manager->getDefaultSettings($type) + $field_type_manager->getDefaultFieldSettings($type);
     $field_definition->itemDefinition->setSettings($default_settings);
     return $field_definition;

  /**
   * Helper to retrieve the field item class.
   *
   * @todo: Remove once getClass() adds in defaults. See
   * https://drupal.org/node/2116341.
   */
  protected function getFieldItemClass() {
    if ($class = $this->getItemDefinition()->getClass()) {
      return $class;
    }
    else {
      $type_definition = \Drupal::typedDataManager()
        ->getDefinition($this->getItemDefinition()->getDataType());
      return $type_definition['class'];
    }
  }

no idea how to clean-up this properly

yched’s picture

Will try to review asap, but FWIW, the "API changes" section in #2287727: Rename FieldConfig to FieldStorageConfig's issue summary provides a good list of the related "side renames" we had to do for FieldStorageConfig (e.g. field_purge_field()...).

swentel’s picture

FileSize
492.91 KB

New green version

swentel’s picture

FileSize
493.47 KB

Keeping up with HEAD

swentel’s picture

FileSize
494.33 KB

Keeping up with HEAD

yched’s picture

Awesome work !

- fixed incorrect doc for FieldItemInterface::settingsForm() (field settings -> storage settings - that was a overlook from the FieldStorage rename)
- $storages var in FieldConfigStorage::loadByProperties() should be $fields
- replaced a couple leftover "instance"s in FieldConfig comments, docs & exception messages
- renamed a couple leftover $instance vars
- renamed createFieldWithInstance() test helper to createFieldWithStorage()

(+ merged HEAD and pushed to the sandbox)

yched’s picture

- There was a leftover conflict marker in content_translation.module (in the middle of a comment, so no syntax error), which showed that the patch reintroduced content_translation_entity_bundle_field_info_alter(), that was removed in #2283977: Create a new ConfigEntity type for storing bundle-specific customizations of base fields

- We will need to be careful when merging with #2224761: Add a generic way to add third party configuration on configuration entities and implement for field configuration, as it touches content_translation_form_field_ui_field_instance_edit_form_alter(), and does stuff in $form['instance']. Here we rename form_id and thus the associated alter hooh, and move to $form['field']

The last submitted patch, 24: 2312093-rename-FieldInstanceConfig-24.patch, failed testing.

swentel’s picture

Yeah merging is sometimes tedious with this patch.

So who's going to review and RTBC this now ? :)

andypost’s picture

I'm following/reviewing changes and last 60k changes in comments are great!

It does not matter who pull the trigger... but who will help the commiter to check a whole codebase for comments that we probably forget to fix...
Maybe it make sense to update summary with a steps to help reviewer to go through?

yched’s picture

FileSize
542.4 KB
720 bytes

Fixed an occurrence of entity_create('field_instance_config') that got added in the last HEAD merge.

Yeah merging is sometimes tedious with this patch

Lol. This just got nominated for the "Understatement Of The Year" award :-D

So who's going to review and RTBC this now ? :)

Yeah, I hesitated a bit before jumping in and pushing code myself, but it would have been tedious. For such patches, I think we have to relax the rules a bit and state that it's ok to RTBC based on people reviewing each other's changes.

swentel’s picture

Yeah, I hesitated a bit before jumping in and pushing code myself, but it would have been tedious. For such patches, I think we have to relax the rules a bit and state that it's ok to RTBC based on people reviewing each other's changes.

Yeah, I guess. Also, with the previous patch, I've did the final patch together while Alex was reviewing on IRC and then he assigned it to catch after. I think this is the way to go again.

The last submitted patch, 25: 2312093-rename-FieldInstanceConfig-25.patch, failed testing.

yched’s picture

but who will help the commiter to check a whole codebase for comments that we probably forget to fix

Well, IMO we have to make a best effort here, but we have to accept the fact that there will probably be leftovers that we will stumble on and fix later on.

A couple thoughts:
- The word "instance" is used for non-Field-related stuff pretty heavily in core
- But most Field-related code now uses Core/Field interfaces, in which the notion of "field instance" is not used
- Thus, the last uses of "instance" in a Field context are in code specifically related to configurable fields

--> IMO doing a full-text search for "instance" within field.module / field_ui.module, and doing the correct replaces, would be that "best effort" ?

yched’s picture

IMO doing a full-text search for "instance" within field.module / field_ui.module, and doing the correct replaces, would be that "best effort" ?

Doing this. I'll probably leave out the "Field API explanation" docblock at the top of field.module, opened #2329665: Move the "Field API doc" topic out of field.module for this.

yched’s picture

Removes the remaining uses of "(field) instance" within field and field_ui modules.

yched’s picture

So the last thing that worries me here is how we name "settings" - mostly in method names in FieldItemInterface & FieldTypePluginManager :

FII:default*Settings()
FII:*settingsToConfigData()
FII:*settingsFromConfigData()
FII:*settingsForm()
FTPM::getDefault*Settings()

The current patch does:
"settings" = the storage settings
"field settings" = the field (ex-instance) settings,

1. It means the storage is the primary notion when you code your FieldItem class, which IMO is not the most natural option. The whole Field API D8 uses FieldDefinition objects as the primary notion.

2. "a field type has settings and field settings" feels like a WTF.
"a field type has settings and storage settings" seems more natural
or "a field type has field settings and storage settings" if we want to be unambiguous, and not put one upfront ?

swentel’s picture

+ 1 for "a field type has field settings and storage settings"

IMO if we then also go for say defaultFieldSettings() and defaultStorageSettings(), Field{whatever} and {Storage}whatever, there is really no way to get confused. It might be a little verbose but it feels really clear to me then.

yched’s picture

Agreed, "field settings" / "storage settings" might be the cleanest. Feel like doing the renames, I'm mosly done for today :-) ?

swentel’s picture

Agreed, "field settings" / "storage settings" might be the cleanest. Feel like doing the renames, I'm mosly done for today :-) ?

Not before monday evening, I can do it then. Unless someone beats me to it.

fago’s picture

"field settings" / "storage settings" makes a lot of sense to me as well.

yched’s picture

OK, did it, then :-)

Renamed "settings" methods in FieldItemInterface and FieldTypePluginManagerInterface as discussed in #35 - #37 :

FII::defaultStorageSettings()
FII::defaultFieldSettings()
FII::storageSettingsToConfigData()
FII::fieldSettingsToConfigData()
FII::storageSettingsFromConfigData()
FII::fieldSettingsFromConfigData()
FII::storageSettingsForm()
FII::fieldSettingsForm()
FTPM::getDefaultStorageSettings()
FTPM::getDefaultFieldSettings()

Added that to the issue summary

Status: Needs review » Needs work

The last submitted patch, 41: 2312093-rename-FieldInstanceConfig-41.patch, failed testing.

yched’s picture

Status: Needs work » Needs review
FileSize
576.07 KB
7.01 KB

A bit too much trust in PhpStorm's rename, didn't catch all of #41's method renames.
This should at least install.

The last submitted patch, 38: 2312093-rename-FieldInstanceConfig-38.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 43: 2312093-rename-FieldInstanceConfig-43.patch, failed testing.

yched’s picture

Status: Needs work » Needs review
FileSize
577.9 KB
6.05 KB

Should be green.

yched’s picture

A couple more var renames, and a few form fixes.

swentel’s picture

FileSize
607.72 KB
42.18 KB

Keeping up with HEAD. Also renamed most of the documentation. I think we're ready to go here.

Berdir’s picture

  1. +++ b/core/lib/Drupal/Core/Config/Entity/ConfigDependencyManager.php
    @@ -16,8 +16,8 @@
      * ensure that configuration entities are imported in the correct order. For
    - * example, node types are created before their fields and the fields are
    - * created before their field instances.
    + * example, node types are created before their field storages and the field
    + * storages are created before their fields.
    

    When adding FieldStorageDefinitionInterface, there was some discussion that it is not the field storage. It is the definition for the field storage. There are a lot of documentation changes that do "fields" => "field storages", I'm not sure that's really correct? Don't have better suggestions, though.

  2. +++ b/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php
    @@ -1754,7 +1754,7 @@ public static function _fieldSqlSchema(FieldStorageDefinitionInterface $storage_
               'default' => '',
    -          'description' => 'The field instance bundle to which this row belongs, used when deleting a field instance',
    +          'description' => 'The field bundle to which this row belongs, used when deleting a field',
             ),
    

    This is weird, what is a "field bundle" ? Maybe use "entity bundle" ?

  3. +++ b/core/modules/field/src/Tests/ConfigFieldDefinitionTest.php
    index ec9b4d7..770155a 100644
    --- a/core/modules/field/src/Tests/CrudTest.php
    
    --- a/core/modules/field/src/Tests/CrudTest.php
    +++ b/core/modules/field/src/Tests/CrudTest.php
    

    FieldInstanceCrudTest is renamed to FieldCrudTest, what about CrudTest? Should we rename that to FieldStorageCrudTest?

  4. +++ b/core/modules/field/src/Tests/CrudTest.php
    @@ -212,13 +212,13 @@ function testRead() {
    -    // Create an instance of the field.
    -    $instance_definition = array(
    +    // Create a field from the field storage.
    

    Not sure about the comment, similar to above. We do this a million times, so maybe just remove the comment? ;)

    Also, this is the only test that is using _definition for the variables.

  5. +++ b/core/themes/bartik/templates/node.html.twig
    @@ -61,12 +61,12 @@
      *
    - * In field variables, each field instance attached to the node a corresponding
    - * variable is defined; for example, 'node.body' becomes 'body'. When needing to
    - * access a field's raw values, developers/themers are strongly encouraged to
    - * use these variables. Otherwise they will have to explicitly specify the
    - * desired field language; for example, 'node.body.en', thus overriding any
    - * language negotiation rule that may have been applied previously.
    + * In field variables, each field attached to the node a corresponding variable
    + * is defined; for example, 'node.body' becomes 'body'. When needing to access
    + * a field's raw values, developers/themers are strongly encouraged to use
    + * these variables. Otherwise they will have to explicitly specify the desired
    + * field language; for example, 'node.body.en', thus overriding any language
    + * negotiation rule that may have been applied previously.
      *
    

    This seems to be a left-over that I think I removed in the original node.html.twig. Those no longer exist => Remove it.

swentel’s picture

Yeah, documentation updates in the patch are tedious :)
Yched also suggested to move these to a follow up, I'd be in favor of that :)

swentel’s picture

FileSize
607.71 KB

no changes, just a reroll

swentel’s picture

FileSize
607.75 KB

Keeping up .. up .. up

Status: Needs review » Needs work

The last submitted patch, 52: 2312093-52.patch, failed testing.

swentel’s picture

Status: Needs work » Needs review
FileSize
608.26 KB
785 bytes
alexpott’s picture

Merged 8.0.x and made further fixes.

swentel’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Avoid commit conflicts

Ok, back to green thanks to Alex. Has been green a couple of times and has been +1'd by yched as well.

Things that can be nitpicked in this patch is terminology in some docs or variable names, but should not hold up this patch as it's big enough already.
These things can be cleaned up afterwards and are ideal novice issues which are perfect for Amsterdam.

The list of change records to update are more or less the same ones as in #2287727: Rename FieldConfig to FieldStorageConfig - a full list is available in the comments there, see https://www.drupal.org/node/2287727#comment-8985027 - will scan for more if needed.

tim.plunkett’s picture

+++ b/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
@@ -137,7 +135,7 @@ public function purgeFieldData(FieldDefinitionInterface $field_definition, $batc
+   * onFieldDelete() or onFieldDelete() has previously run.

Is this right? I don't see any methods called that, either in HEAD or changed in this patch.
Not to hold up commit, just that its very confusing.

effulgentsia’s picture

+1 to the RTBC. Some followup material:

  1. +++ b/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
    @@ -137,7 +135,7 @@ public function purgeFieldData(FieldDefinitionInterface $field_definition, $batc
    -   * onFieldDelete() or onFieldInstanceDelete() has previously run.
    +   * onFieldDelete() or onFieldDelete() has previously run.
    

    Huh?

  2. +++ b/core/lib/Drupal/Core/Field/FieldConfigBase.php
    @@ -32,7 +32,7 @@
    +   * The name of the field attached to the bundle by this field.
    

    Huh?

  3. +++ b/core/lib/Drupal/Core/Field/FieldConfigStorageBase.php
    @@ -39,7 +39,7 @@ protected function mapFromStorageRecords(array $records) {
    -    $record['settings'] = $class::instanceSettingsToConfigData($record['settings']);
    +    $record['settings'] = $class::fieldSettingsFromConfigData($record['settings']);
    

    Should be fieldSettingsToConfigData? Do we not have test coverage for this?

  4. +++ b/core/modules/user/user.js
    @@ -174,25 +174,4 @@
    -  /**
    -   * Field instance settings screen: force the 'Display on registration form'
    -   * checkbox checked whenever 'Required' is checked.
    -   */
    -  Drupal.behaviors.fieldUserRegistration = {
    -    attach: function (context, settings) {
    -      var $checkbox = $('form#field-ui-field-edit-form input#edit-instance-settings-user-register-form');
    -
    -      if ($checkbox.length) {
    -        $(context).find('input#edit-instance-required').once('user-register-form-checkbox', function () {
    -          $(this).on('change', function (e) {
    -            if ($(this).prop('checked')) {
    -              $checkbox.prop('checked', true);
    -            }
    -          });
    -        });
    -
    -      }
    -    }
    -  };
    -
    

    Why is this JS no longer needed?

webchick’s picture

Status: Reviewed & tested by the community » Fixed

I'm high on cold meds atm so am not able to review this thoroughly, but in glancing through it looks pretty straight-forward. Thanks for identifying issues to fix in follow-ups.

Committed and pushed to 8.x. Thanks!

  • webchick committed 1476c56 on 8.0.x
    Issue #2312093 by alexpott, yched, andypost, swentel | xjm: Rename...
andypost’s picture

+++ b/core/lib/Drupal/Core/Field/FieldConfigStorageBase.php
@@ -39,7 +39,7 @@ protected function mapFromStorageRecords(array $records) {
-    $record['settings'] = $class::instanceSettingsToConfigData($record['settings']);
+    $record['settings'] = $class::fieldSettingsFromConfigData($record['settings']);

Should be fieldSettingsToConfigData? Do we not have test coverage for this?

both methods simply return $settings; so it works

The test coverage needs separate issue.

alexpott’s picture

Re #58:

  1. Yep needs fixing
  2. Yep needs fixing
  3. Yep
  4. Because the "user-register-form-checkbox" no longer exists this - this js been redundant this became a form mode :)
yched’s picture

Yay ! Thanks all !

xjm’s picture

Status: Needs review » Fixed
Issue tags: -Needs issue summary update, -Avoid commit conflicts +Needs followup

Can we please file followups? The 600K beta deadline part of this is done so let's keep that queue clean.

Also, can someone confirm when the change record updates are completed? :)

anavarre’s picture

In the same vein as #2287727 (#66), if you have config files from a custom module you wish to mass-update, run the below command from within your custommodule/config/install dir after you've backed up everything first:
$ find . -name 'field.instance*' -execdir bash -c 'mv -i "$1" "${1//field.instance/field.field}"' bash {} \;

andypost’s picture

Issue tags: -Needs followup
yched’s picture

swentel’s picture

Updated all change record listed in https://www.drupal.org/node/2287727#comment-8985027 + a couple more.

Status: Fixed » Closed (fixed)

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

vijaycs85’s picture

Title: Rename FieldInstanceConfig to FieldConfig » [Change record update] Rename FieldInstanceConfig to FieldConfig
Status: Closed (fixed) » Active

we need to update https://www.drupal.org/node/2064123 as well.

vijaycs85’s picture

Status: Active » Needs review
yched’s picture

Title: [Change record update] Rename FieldInstanceConfig to FieldConfig » Rename FieldInstanceConfig to FieldConfig
Status: Needs review » Closed (fixed)
Issue tags: -Needs change record updates

Looks good. Thanks @vijaycs85 !

amateescu’s picture

+++ b/core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php
@@ -37,13 +37,13 @@ public function testDefaultImages() {
-    foreach (array('field', 'instance', 'instance2', 'field_new', 'instance_new') as $image_target) {
+    foreach (array('field', 'field', 'field2', 'field_new', 'field_new') as $image_target) {

This change caused a regression in the test coverage of the default images, here's a followup for it: #2903332: Regression: lost test coverage for handling default images in the Image field