Issue #2115291 by plopesc, agentrickard: Field types must use as provider its own module instead of Core when are defined in hook_field_info_alter().
							parent
							
								
									2f4b95bae4
								
							
						
					
					
						commit
						958056da9b
					
				| 
						 | 
					@ -41,6 +41,7 @@ function email_field_info_alter(&$info) {
 | 
				
			||||||
  else {
 | 
					  else {
 | 
				
			||||||
    $info['email']['default_formatter'] = 'email_mailto';
 | 
					    $info['email']['default_formatter'] = 'email_mailto';
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  $info['email']['provider'] = 'email';
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -90,6 +90,9 @@ class EmailFieldTest extends WebTestBase {
 | 
				
			||||||
      ))
 | 
					      ))
 | 
				
			||||||
      ->save();
 | 
					      ->save();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Rebuild field info to check if email field still working.
 | 
				
			||||||
 | 
					    field_sync_field_status();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Display creation form.
 | 
					    // Display creation form.
 | 
				
			||||||
    $this->drupalGet('entity_test/add');
 | 
					    $this->drupalGet('entity_test/add');
 | 
				
			||||||
    $this->assertFieldByName("{$field_name}[0][value]", '', 'Widget found.');
 | 
					    $this->assertFieldByName("{$field_name}[0][value]", '', 'Widget found.');
 | 
				
			||||||
| 
						 | 
					@ -106,13 +109,14 @@ class EmailFieldTest extends WebTestBase {
 | 
				
			||||||
    preg_match('|entity_test/manage/(\d+)|', $this->url, $match);
 | 
					    preg_match('|entity_test/manage/(\d+)|', $this->url, $match);
 | 
				
			||||||
    $id = $match[1];
 | 
					    $id = $match[1];
 | 
				
			||||||
    $this->assertText(t('entity_test @id has been created.', array('@id' => $id)));
 | 
					    $this->assertText(t('entity_test @id has been created.', array('@id' => $id)));
 | 
				
			||||||
    $this->assertRaw($value);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Verify that a mailto link is displayed.
 | 
					    if ($this->assertRaw($value)) {
 | 
				
			||||||
    $entity = entity_load('entity_test', $id);
 | 
					      // Verify that a mailto link is displayed.
 | 
				
			||||||
    $display = entity_get_display($entity->entityType(), $entity->bundle(), 'full');
 | 
					      $entity = entity_load('entity_test', $id);
 | 
				
			||||||
    $entity->content = field_attach_view($entity, $display);
 | 
					      $display = entity_get_display($entity->entityType(), $entity->bundle(), 'full');
 | 
				
			||||||
    $this->drupalSetContent(drupal_render($entity->content));
 | 
					      $entity->content = field_attach_view($entity, $display);
 | 
				
			||||||
    $this->assertLinkByHref('mailto:test@example.com');
 | 
					      $this->drupalSetContent(drupal_render($entity->content));
 | 
				
			||||||
 | 
					      $this->assertLinkByHref('mailto:test@example.com');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,6 +25,7 @@ function entity_reference_field_info_alter(&$info) {
 | 
				
			||||||
  $info['entity_reference']['default_widget'] = 'entity_reference_autocomplete';
 | 
					  $info['entity_reference']['default_widget'] = 'entity_reference_autocomplete';
 | 
				
			||||||
  $info['entity_reference']['default_formatter'] = 'entity_reference_label';
 | 
					  $info['entity_reference']['default_formatter'] = 'entity_reference_label';
 | 
				
			||||||
  $info['entity_reference']['list_class'] = '\Drupal\entity_reference\Plugin\Field\FieldType\ConfigurableEntityReferenceFieldItemList';
 | 
					  $info['entity_reference']['list_class'] = '\Drupal\entity_reference\Plugin\Field\FieldType\ConfigurableEntityReferenceFieldItemList';
 | 
				
			||||||
 | 
					  $info['entity_reference']['provider'] = 'entity_reference';
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -69,6 +69,9 @@ class EntityReferenceFieldDefaultValueTest extends WebTestBase {
 | 
				
			||||||
    ));
 | 
					    ));
 | 
				
			||||||
    $this->instance->save();
 | 
					    $this->instance->save();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Rebuild field info to check if entity_reference field still working.
 | 
				
			||||||
 | 
					    field_sync_field_status();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Set created node as default_value.
 | 
					    // Set created node as default_value.
 | 
				
			||||||
    $instance_edit = array(
 | 
					    $instance_edit = array(
 | 
				
			||||||
      'default_value_input[' . $this->field->name . '][0][target_id]' => $referenced_node->getTitle() . ' (' .$referenced_node->id() . ')',
 | 
					      'default_value_input[' . $this->field->name . '][0][target_id]' => $referenced_node->getTitle() . ' (' .$referenced_node->id() . ')',
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue