Commit a57630c8 authored by catch's avatar catch

Issue #2287727 by yched, swentel, alexpott: Rename Field[instance]Config...

Issue #2287727 by yched, swentel, alexpott: Rename Field[instance]Config classes and entity types (again).
parent 9c86984c
......@@ -85,12 +85,12 @@ public function status();
* because imported entities were already given the body field when they were
* originally created, and the imported configuration includes all of their
* currently-configured fields. On the other hand,
* \Drupal\field\Entity\FieldConfig::preSave() and the methods it calls make
* sure that the storage tables are created or updated for the field
* configuration entity, which is not a configuration change, and it must be
* done whether due to an import or not. So, the first method should check
* $entity->isSyncing() and skip executing if it returns TRUE, and the second
* should not perform this check.
* \Drupal\field\Entity\FieldStorageConfig::preSave() and the methods it calls
* make sure that the storage tables are created or updated for the field
* storage configuration entity, which is not a configuration change, and it
* must be done whether due to an import or not. So, the first method should
* check $entity->isSyncing() and skip executing if it returns TRUE, and the
* second should not perform this check.
*
* @return bool
* TRUE if the configuration entity is being created, updated, or deleted
......
......@@ -19,7 +19,7 @@
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\Language\LanguageInterface;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
......@@ -1934,7 +1934,7 @@ public static function _fieldIndexName(FieldStorageDefinitionInterface $storage_
* unique among all other fields.
*/
public static function _fieldColumnName(FieldStorageDefinitionInterface $storage_definition, $column) {
return in_array($column, FieldConfig::getReservedColumns()) ? $column : $storage_definition->getName() . '_' . $column;
return in_array($column, FieldStorageConfig::getReservedColumns()) ? $column : $storage_definition->getName() . '_' . $column;
}
}
......@@ -13,8 +13,8 @@
use Drupal\Core\Entity\ContentEntityDatabaseStorage;
use Drupal\Core\Entity\Query\QueryException;
use Drupal\Core\Entity\Sql\SqlEntityStorageInterface;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\FieldConfigInterface;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\field\FieldStorageConfigInterface;
/**
* Adds tables and fields to the SQL entity query.
......@@ -107,20 +107,20 @@ public function addField($field, $type, $langcode) {
// field.
$specifier = $specifiers[$key];
if (isset($field_storage_definitions[$specifier])) {
$field = $field_storage_definitions[$specifier];
$field_storage = $field_storage_definitions[$specifier];
}
else {
$field = FALSE;
$field_storage = FALSE;
}
// If we managed to retrieve a configurable field, process it.
if ($field instanceof FieldConfigInterface) {
if ($field_storage instanceof FieldStorageConfigInterface) {
// Find the field column.
$column = $field->getMainPropertyName();
$column = $field_storage->getMainPropertyName();
if ($key < $count) {
$next = $specifiers[$key + 1];
// Is this a field column?
$columns = $field->getColumns();
if (isset($columns[$next]) || in_array($next, FieldConfig::getReservedColumns())) {
$columns = $field_storage->getColumns();
if (isset($columns[$next]) || in_array($next, FieldStorageConfig::getReservedColumns())) {
// Use it.
$column = $next;
// Do not process it again.
......@@ -135,14 +135,14 @@ public function addField($field, $type, $langcode) {
// also use the property definitions for column.
if ($key < $count) {
$relationship_specifier = $specifiers[$key + 1];
$propertyDefinitions = $field->getPropertyDefinitions();
$propertyDefinitions = $field_storage->getPropertyDefinitions();
// Prepare the next index prefix.
$next_index_prefix = "$relationship_specifier.$column";
}
}
$table = $this->ensureFieldTable($index_prefix, $field, $type, $langcode, $base_table, $entity_id_field, $field_id_field);
$sql_column = ContentEntityDatabaseStorage::_fieldColumnName($field, $column);
$table = $this->ensureFieldTable($index_prefix, $field_storage, $type, $langcode, $base_table, $entity_id_field, $field_id_field);
$sql_column = ContentEntityDatabaseStorage::_fieldColumnName($field_storage, $column);
}
// This is an entity base field (non-configurable field).
else {
......@@ -161,16 +161,16 @@ public function addField($field, $type, $langcode) {
$table = $this->ensureEntityTable($index_prefix, $specifier, $type, $langcode, $base_table, $entity_id_field, $entity_tables);
}
// If there are more specifiers to come, it's a relationship.
if ($field && $key < $count) {
if ($field_storage && $key < $count) {
// Computed fields have prepared their property definition already, do
// it for properties as well.
if (!$propertyDefinitions) {
$propertyDefinitions = $field->getPropertyDefinitions();
$propertyDefinitions = $field_storage->getPropertyDefinitions();
$relationship_specifier = $specifiers[$key + 1];
$next_index_prefix = $relationship_specifier;
}
// Check for a valid relationship.
if (isset($propertyDefinitions[$relationship_specifier]) && $field->getPropertyDefinition('entity')->getDataType() == 'entity_reference' ) {
if (isset($propertyDefinitions[$relationship_specifier]) && $field_storage->getPropertyDefinition('entity')->getDataType() == 'entity_reference' ) {
// If it is, use the entity type.
$entity_type_id = $propertyDefinitions[$relationship_specifier]->getTargetDefinition()->getEntityTypeId();
$entity_type = $this->entityManager->getDefinition($entity_type_id);
......
......@@ -27,20 +27,20 @@
* It is up to the class implementing this interface to manage where the
* information comes from. For example, field.module provides an implementation
* based on two levels of configuration. It allows the site administrator to add
* custom fields to any entity type and bundle via the "field_config" and
* "field_instance_config" configuration entities. The former for storing
* custom fields to any entity type and bundle via the "field_storage_config"
* and "field_instance_config" configuration entities. The former for storing
* configuration that is independent of which entity type and bundle the field
* is added to, and the latter for storing configuration that is specific to the
* entity type and bundle. The class that implements "field_instance_config"
* configuration entities also implements this interface, returning information
* from either itself, or from the corresponding "field_config" configuration,
* as appropriate.
* from either itself, or from the corresponding "field_storage_config"
* configuration, as appropriate.
*
* However, entity base fields, such as $node->title, are not managed by
* field.module and its "field_config"/"field_instance_config" configuration
* entities. Therefore, their definitions are provided by different objects
* based on the class \Drupal\Core\Field\FieldDefinition, which implements this
* interface as well.
* field.module and its "field_storage_config"/"field_instance_config"
* configuration entities. Therefore, their definitions are provided by
* different objects based on the class \Drupal\Core\Field\FieldDefinition,
* which implements this interface as well.
*
* Field definitions may fully define a concrete data object (e.g.,
* $node_1->body), or may provide a best-guess definition for a data object that
......
......@@ -234,8 +234,8 @@ public static function defaultInstanceSettings();
/**
* Returns a form for the field-level settings.
*
* Invoked from \Drupal\field_ui\Form\FieldEditForm to allow administrators to
* configure field-level settings.
* Invoked from \Drupal\field_ui\Form\FieldStorageEditForm to allow
* administrators to configure field-level settings.
*
* Field storage might reject field definition changes that affect the field
* storage schema if the field already has data. When the $has_data parameter
......
......@@ -6,8 +6,8 @@
*/
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldInstanceConfig;
use Drupal\field\Entity\FieldStorageConfig;
/**
* Implements hook_help().
......@@ -77,19 +77,19 @@ function block_content_entity_type_alter(array &$entity_types) {
*/
function block_content_add_body_field($block_type_id, $label = 'Body') {
// Add or remove the body field, as needed.
$field = FieldConfig::loadByName('block_content', 'body');
$field_storage = FieldStorageConfig::loadByName('block_content', 'body');
$instance = FieldInstanceConfig::loadByName('block_content', $block_type_id, 'body');
if (empty($field)) {
$field = entity_create('field_config', array(
if (empty($field_storage)) {
$field_storage = entity_create('field_storage_config', array(
'name' => 'body',
'entity_type' => 'block_content',
'type' => 'text_with_summary',
));
$field->save();
$field_storage->save();
}
if (empty($instance)) {
$instance = entity_create('field_instance_config', array(
'field' => $field,
'field_storage' => $field_storage,
'bundle' => $block_type_id,
'label' => $label,
'settings' => array('display_summary' => FALSE),
......
......@@ -26,9 +26,9 @@ class BlockContentFieldTest extends BlockContentTestBase {
/**
* The created field.
*
* @var \Drupal\field\Entity\FieldConfig
* @var \Drupal\field\Entity\FieldStorageConfig
*/
protected $field;
protected $fieldStorage;
/**
* The created instance.
......@@ -54,15 +54,15 @@ public function testBlockFields() {
$this->blockType = $this->createBlockContentType('link');
// Create a field with settings to validate.
$this->field = entity_create('field_config', array(
$this->fieldStorage = entity_create('field_storage_config', array(
'name' => drupal_strtolower($this->randomName()),
'entity_type' => 'block_content',
'type' => 'link',
'cardinality' => 2,
));
$this->field->save();
$this->fieldStorage->save();
$this->instance = entity_create('field_instance_config', array(
'field' => $this->field,
'field_storage' => $this->fieldStorage,
'bundle' => 'link',
'settings' => array(
'title' => DRUPAL_OPTIONAL,
......@@ -70,12 +70,12 @@ public function testBlockFields() {
));
$this->instance->save();
entity_get_form_display('block_content', 'link', 'default')
->setComponent($this->field->getName(), array(
->setComponent($this->fieldStorage->getName(), array(
'type' => 'link_default',
))
->save();
entity_get_display('block_content', 'link', 'default')
->setComponent($this->field->getName(), array(
->setComponent($this->fieldStorage->getName(), array(
'type' => 'link',
'label' => 'hidden',
))
......@@ -85,8 +85,8 @@ public function testBlockFields() {
$this->drupalGet('block/add/link');
$edit = array(
'info[0][value]' => $this->randomName(8),
$this->field->getName() . '[0][url]' => 'http://example.com',
$this->field->getName() . '[0][title]' => 'Example.com'
$this->fieldStorage->getName() . '[0][url]' => 'http://example.com',
$this->fieldStorage->getName() . '[0][title]' => 'Example.com'
);
$this->drupalPostForm(NULL, $edit, t('Save'));
$block = entity_load('block_content', 1);
......
......@@ -6,14 +6,14 @@
*/
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
/**
* Implements hook_uninstall().
*/
function comment_uninstall() {
// Remove the comment fields.
$fields = entity_load_multiple_by_properties('field_config', array('type' => 'comment'));
$fields = entity_load_multiple_by_properties('field_storage_config', array('type' => 'comment'));
foreach ($fields as $field) {
$field->delete();
}
......@@ -56,7 +56,7 @@ function comment_schema() {
'type' => 'varchar',
'not null' => TRUE,
'default' => '',
'length' => FieldConfig::NAME_MAX_LENGTH,
'length' => FieldStorageConfig::NAME_MAX_LENGTH,
'description' => 'The field_name of the field that was used to add this comment.',
),
'cid' => array(
......
......@@ -24,9 +24,9 @@
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Render\Element;
use Drupal\Core\Url;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\field\FieldInstanceConfigInterface;
use Drupal\field\FieldConfigInterface;
use Drupal\field\FieldStorageConfigInterface;
use Drupal\file\FileInterface;
use Drupal\user\EntityOwnerInterface;
use Drupal\node\NodeInterface;
......@@ -174,12 +174,12 @@ function comment_field_instance_config_update(FieldInstanceConfigInterface $inst
}
/**
* Implements hook_ENTITY_TYPE_insert() for 'field_config'.
* Implements hook_ENTITY_TYPE_insert() for 'field_storage_config'.
*/
function comment_field_config_insert(FieldConfigInterface $field) {
if ($field->getType() == 'comment') {
function comment_field_storage_config_insert(FieldStorageConfigInterface $field_storage) {
if ($field_storage->getType() == 'comment') {
// Check that the target entity type uses an integer ID.
$entity_type_id = $field->getTargetEntityTypeId();
$entity_type_id = $field_storage->getTargetEntityTypeId();
if (!_comment_entity_uses_integer_id($entity_type_id)) {
throw new \UnexpectedValueException('You cannot attach a comment field to an entity with a non-integer ID field');
}
......@@ -646,7 +646,7 @@ function comment_form_field_ui_display_overview_form_alter(&$form, $form_state)
/**
* Implements hook_form_FORM_ID_alter().
*/
function comment_form_field_ui_field_edit_form_alter(&$form, $form_state) {
function comment_form_field_ui_field_storage_edit_form_alter(&$form, $form_state) {
if ($form['#field']->getType() == 'comment') {
// We only support posting one comment at the time so it doesn't make sense
// to let the site builder choose anything else.
......
......@@ -19,7 +19,7 @@
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\StringTranslation\TranslationInterface;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\field\Entity\FieldInstanceConfig;
/**
......@@ -158,9 +158,9 @@ public function addDefaultField($entity_type, $bundle, $field_name = 'comment',
))->save();
}
// Make sure the field doesn't already exist.
if (!FieldConfig::loadByName($entity_type, $field_name)) {
if (!FieldStorageConfig::loadByName($entity_type, $field_name)) {
// Add a default comment field for existing node comments.
$field = $this->entityManager->getStorage('field_config')->create(array(
$field_storage = $this->entityManager->getStorage('field_storage_config')->create(array(
'entity_type' => $entity_type,
'name' => $field_name,
'type' => 'comment',
......@@ -170,7 +170,7 @@ public function addDefaultField($entity_type, $bundle, $field_name = 'comment',
),
));
// Create the field.
$field->save();
$field_storage->save();
}
// Make sure the instance doesn't already exist.
if (!array_key_exists($field_name, $this->entityManager->getFieldDefinitions($entity_type, $bundle))) {
......@@ -235,14 +235,14 @@ public function addDefaultField($entity_type, $bundle, $field_name = 'comment',
*/
public function addBodyField($comment_type_id) {
// Create the field if needed.
$field = FieldConfig::loadByName('comment', 'comment_body');
if (!$field) {
$field = $this->entityManager->getStorage('field_config')->create(array(
$field_storage = FieldStorageConfig::loadByName('comment', 'comment_body');
if (!$field_storage) {
$field_storage = $this->entityManager->getStorage('field_storage_config')->create(array(
'name' => 'comment_body',
'type' => 'text_long',
'entity_type' => 'comment',
));
$field->save();
$field_storage->save();
}
if (!FieldInstanceConfig::loadByName('comment', $comment_type_id, 'comment_body')) {
// Attaches the body field by default.
......
......@@ -9,7 +9,7 @@
use Drupal\Core\Entity\EntityFormBuilderInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
/**
* Defines a service for comment post render cache callbacks.
......@@ -60,12 +60,12 @@ public function __construct(EntityManagerInterface $entity_manager, EntityFormBu
public function renderForm(array $element, array $context) {
$field_name = $context['field_name'];
$entity = $this->entityManager->getStorage($context['entity_type'])->load($context['entity_id']);
$field = Fieldconfig::loadByName($entity->getEntityTypeId(), $field_name);
$field_storage = FieldStorageConfig::loadByName($entity->getEntityTypeId(), $field_name);
$values = array(
'entity_type' => $entity->getEntityTypeId(),
'entity_id' => $entity->id(),
'field_name' => $field_name,
'comment_type' => $field->getSetting('bundle'),
'comment_type' => $field_storage->getSetting('bundle'),
'pid' => NULL,
);
$comment = $this->entityManager->getStorage('comment')->create($values);
......
......@@ -13,7 +13,7 @@
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\FieldDefinition;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\user\UserInterface;
/**
......@@ -302,7 +302,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields['field_name'] = FieldDefinition::create('string')
->setLabel(t('Comment field name'))
->setDescription(t('The field name through which this comment was added.'))
->setSetting('max_length', FieldConfig::NAME_MAX_LENGTH);
->setSetting('max_length', FieldStorageConfig::NAME_MAX_LENGTH);
return $fields;
}
......@@ -509,8 +509,8 @@ public function getChangedTime() {
*/
public static function preCreate(EntityStorageInterface $storage, array &$values) {
if (empty($values['comment_type']) && !empty($values['field_name']) && !empty($values['entity_type'])) {
$field = FieldConfig::loadByName($values['entity_type'], $values['field_name']);
$values['comment_type'] = $field->getSetting('comment_type');
$field_storage = FieldStorageConfig::loadByName($values['entity_type'], $values['field_name']);
$values['comment_type'] = $field_storage->getSetting('comment_type');
}
}
......
......@@ -12,7 +12,7 @@
use Drupal\Core\Entity\EntityManager;
use Drupal\Core\Entity\Query\QueryFactory;
use Drupal\Core\Url;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
......@@ -116,11 +116,11 @@ public function buildForm(array $form, array &$form_state) {
$entity_type = $this->entity->getTargetEntityTypeId();
$caption = '';
foreach (array_keys($this->commentManager->getFields($entity_type)) as $field_name) {
/** @var \Drupal\field\FieldConfigInterface $field */
if (($field = FieldConfig::loadByName($entity_type, $field_name)) && $field->getSetting('comment_type') == $this->entity->id() && !$field->deleted) {
/** @var \Drupal\field\FieldStorageConfigInterface $field_storage */
if (($field_storage = FieldStorageConfig::loadByName($entity_type, $field_name)) && $field_storage->getSetting('comment_type') == $this->entity->id() && !$field_storage->deleted) {
$caption .= '<p>' . $this->t('%label is used by the %field field on your site. You can not remove this comment type until you have removed the field.', array(
'%label' => $this->entity->label(),
'%field' => $field->label(),
'%field' => $field_storage->label(),
)) . '</p>';
}
}
......
......@@ -8,7 +8,7 @@
namespace Drupal\comment\Tests;
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\field\Entity\FieldInstanceConfig;
/**
......@@ -41,8 +41,8 @@ function testCommentDefaultFields() {
$instance->delete();
// Check that the 'comment_body' field is deleted.
$field = FieldConfig::loadByName('comment', 'comment_body');
$this->assertTrue(empty($field), 'The comment_body field was deleted');
$field_storage = FieldStorageConfig::loadByName('comment', 'comment_body');
$this->assertTrue(empty($field_storage), 'The comment_body field was deleted');
// Create a new content type.
$type_name = 'test_node_type_2';
......@@ -51,15 +51,15 @@ function testCommentDefaultFields() {
// Check that the 'comment_body' field exists and has an instance on the
// new comment bundle.
$field = FieldConfig::loadByName('comment', 'comment_body');
$this->assertTrue($field, 'The comment_body field exists');
$field_storage = FieldStorageConfig::loadByName('comment', 'comment_body');
$this->assertTrue($field_storage, 'The comment_body field exists');
$instance = FieldInstanceConfig::loadByName('comment', 'comment', 'comment_body');
$this->assertTrue(isset($instance), format_string('The comment_body field is present for comments on type @type', array('@type' => $type_name)));
// Test adding a field that defaults to CommentItemInterface::CLOSED.
$this->container->get('comment.manager')->addDefaultField('node', 'test_node_type', 'who_likes_ponies', CommentItemInterface::CLOSED, 'who_likes_ponies');
$field = entity_load('field_instance_config', 'node.test_node_type.who_likes_ponies');
$this->assertEqual($field->default_value[0]['status'], CommentItemInterface::CLOSED);
$field_storage = entity_load('field_instance_config', 'node.test_node_type.who_likes_ponies');
$this->assertEqual($field_storage->default_value[0]['status'], CommentItemInterface::CLOSED);
}
/**
......@@ -71,9 +71,9 @@ function testCommentInstallAfterContentModule() {
$this->drupalLogin($this->admin_user);
// Drop default comment field added in CommentTestBase::setup().
FieldConfig::loadByName('node', 'comment')->delete();
if ($field = FieldConfig::loadByName('node', 'comment_forum')) {
$field->delete();
FieldStorageConfig::loadByName('node', 'comment')->delete();
if ($field_storage = FieldStorageConfig::loadByName('node', 'comment_forum')) {
$field_storage->delete();
}
// Purge field data now to allow comment module to be uninstalled once the
......
......@@ -9,7 +9,7 @@
use Drupal\comment\Entity\Comment;
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\simpletest\WebTestBase;
/**
......@@ -70,10 +70,10 @@ function setUp() {
$this->container->get('comment.manager')->addDefaultField('node', 'article');
// Make comment body translatable.
$field = FieldConfig::loadByName('comment', 'comment_body');
$field->translatable = TRUE;
$field->save();
$this->assertTrue($field->isTranslatable(), 'Comment body is translatable.');
$field_storage = FieldStorageConfig::loadByName('comment', 'comment_body');
$field_storage->translatable = TRUE;
$field_storage->save();
$this->assertTrue($field_storage->isTranslatable(), 'Comment body is translatable.');
}
/**
......
......@@ -27,11 +27,11 @@ function testNodeDeletion() {
$this->assertFalse(Comment::load($comment->id()), 'The comment could not be loaded after the node was deleted.');
// Make sure the comment field and all its instances are deleted when node
// type is deleted.
$this->assertNotNull(entity_load('field_config', 'node.comment'), 'Comment field exists');
$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');
// Delete the node type.
entity_delete_multiple('node_type', array($this->node->bundle()));
$this->assertNull(entity_load('field_config', 'node.comment'), 'Comment field deleted');
$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');
}
}
......@@ -397,9 +397,9 @@ function testCommentFunctionality() {
$this->assertRaw(t('Saved %name configuration', array('%name' => 'Barfoo')));
// Check the field contains the correct comment type.
$field = entity_load('field_config', 'entity_test.field_barfoo');
$this->assertTrue($field);
$this->assertEqual($field->getSetting('comment_type'), 'foobar');
$field_storage = entity_load('field_storage_config', 'entity_test.field_barfoo');
$this->assertTrue($field_storage);
$this->assertEqual($field_storage->getSetting('comment_type'), 'foobar');
// Test the new entity commenting inherits default.
$random_label = $this->randomName();
......
......@@ -50,7 +50,7 @@ public function testCommentFieldNonStringId() {
'target_entity_type_id' => 'entity_test_string_id',
));
$bundle->save();
$field = entity_create('field_config', array(
$field_storage = entity_create('field_storage_config', array(
'name' => 'foo',
'entity_type' => 'entity_test_string_id',
'settings' => array(
......@@ -58,7 +58,7 @@ public function testCommentFieldNonStringId() {
),
'type' => 'comment',
));
$field->save();
$field_storage->save();
$this->fail('Did not throw an exception as expected.');
}
catch (\UnexpectedValueException $e) {
......
......@@ -9,7 +9,7 @@
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
use Drupal\content_translation\Tests\ContentTranslationUITest;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
/**
* Tests the Comment Translation UI.
......@@ -68,9 +68,9 @@ protected function getTranslatorPermissions() {
*/
function setupTestFields() {
parent::setupTestFields();
$field = FieldConfig::loadByName('comment', 'comment_body');
$field->translatable = TRUE;
$field->save();
$field_storage = FieldStorageConfig::loadByName('comment', 'comment_body');
$field_storage->translatable = TRUE;
$field_storage->save();
}
/**
......
......@@ -9,7 +9,7 @@
use Drupal\comment\Entity\Comment;
use Drupal\comment\Entity\CommentType;