diff --git a/core/modules/file/file.module b/core/modules/file/file.module index a7dfc48..9ba7b44 100644 --- a/core/modules/file/file.module +++ b/core/modules/file/file.module @@ -1996,9 +1996,10 @@ function file_get_file_references(File $file, $field = NULL, $age = FIELD_LOAD_R if ($field || $field_type) { foreach ($return as $field_name => $data) { foreach (array_keys($data) as $entity_type) { - $current_field = field_info_field($entity_type, $field_name); - if (($field_type && $current_field['type'] != $field_type) || ($field && $field['id'] != $current_field['id'])) { - unset($return[$field_name][$entity_type]); + $current_field = field_info_field($entity_type, $field_name); + if (($field_type && $current_field['type'] != $field_type) || ($field && $field['id'] != $current_field['id'])) { + unset($return[$field_name][$entity_type]); + } } } } diff --git a/core/modules/options/lib/Drupal/options/Tests/OptionsWidgetsTest.php b/core/modules/options/lib/Drupal/options/Tests/OptionsWidgetsTest.php index a799441..afa8a94 100644 --- a/core/modules/options/lib/Drupal/options/Tests/OptionsWidgetsTest.php +++ b/core/modules/options/lib/Drupal/options/Tests/OptionsWidgetsTest.php @@ -528,7 +528,12 @@ function testOnOffCheckbox() { // Display form: with 'off' value, option is unchecked. $this->drupalGet('entity_test/manage/' . $entity->id() . '/edit'); $this->assertNoFieldChecked("edit-bool-$langcode"); + } + /** + * Tests that the 'options_onoff' widget has a 'display_label' setting. + */ + function testOnOffCheckboxLabelSetting() { // Create Basic page node type. $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page')); @@ -537,11 +542,17 @@ function testOnOffCheckbox() { $this->drupalLogin($admin_user); // Create a test field instance. - $fieldUpdate = $this->bool; - $fieldUpdate['settings']['allowed_values'] = array(0 => 0, 1 => 'MyOnValue'); - $fieldUpdate->save(); + entity_create('field_entity', array( + 'name' => 'bool', + 'entity_type' => 'node', + 'type' => 'list_boolean', + 'cardinality' => 1, + 'settings' => array( + 'allowed_values' => array(0 => 'Zero', 1 => 'Some & unescaped markup'), + ), + ))->save(); entity_create('field_instance', array( - 'field_name' => $this->bool->name, + 'field_name' => 'bool', 'entity_type' => 'node', 'bundle' => 'page', ))->save(); @@ -587,4 +598,5 @@ function testOnOffCheckbox() { t('Display label changes label of the checkbox') ); } + }