Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
00339b3d
Commit
00339b3d
authored
May 27, 2014
by
alexpott
Browse files
Issue
#2167167
by Berdir: Remove field_info_*().
parent
2d3d33b4
Changes
71
Hide whitespace changes
Inline
Side-by-side
core/core.services.yml
View file @
00339b3d
...
...
@@ -224,7 +224,7 @@ services:
arguments
:
[
'
@config.factory'
,
'
@module_handler'
,
'
@state'
,
'
@info_parser'
,
'
@config.installer'
,
'
@router.builder'
]
entity.manager
:
class
:
Drupal\Core\Entity\EntityManager
arguments
:
[
'
@container.namespaces'
,
'
@module_handler'
,
'
@cache.discovery'
,
'
@language_manager'
,
'
@string_translation'
,
'
@class_resolver'
]
arguments
:
[
'
@container.namespaces'
,
'
@module_handler'
,
'
@cache.discovery'
,
'
@language_manager'
,
'
@string_translation'
,
'
@class_resolver'
,
'
@typed_data_manager'
]
parent
:
container.trait
tags
:
-
{
name
:
plugin_manager_cache_clear
}
...
...
core/includes/entity.inc
View file @
00339b3d
...
...
@@ -10,15 +10,6 @@
use
Drupal\Core\Entity\EntityInterface
;
use
Drupal\Core\Language\Language
;
/**
* Resets the cached information about entity types.
*/
function
entity_info_cache_clear
()
{
// Clear all languages.
\
Drupal
::
entityManager
()
->
clearCachedDefinitions
();
\
Drupal
::
entityManager
()
->
clearCachedFieldDefinitions
();
}
/**
* Clears the entity render cache for all entity types.
*/
...
...
@@ -67,7 +58,7 @@ function entity_get_bundles($entity_type = NULL) {
* NULL.
*/
function
entity_invoke_bundle_hook
(
$hook
,
$entity_type
,
$bundle
,
$bundle_new
=
NULL
)
{
entity_info_cache_clear
();
\
Drupal
::
entityManager
()
->
clearCachedBundles
();
// Notify the entity storage.
$method
=
'onBundle'
.
ucfirst
(
$hook
);
...
...
core/lib/Drupal/Core/Config/Entity/ConfigEntityInterface.php
View file @
00339b3d
...
...
@@ -85,10 +85,10 @@ 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\Field::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
* \Drupal\field\Entity\Field
Config
::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.
*
...
...
core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
View file @
00339b3d
...
...
@@ -8,6 +8,7 @@
namespace
Drupal\Core\Entity
;
use
Drupal\Component\Utility\String
;
use
Drupal\Core\Cache\Cache
;
use
Drupal\Core\Field\PrepareCacheInterface
;
use
Drupal\field\FieldConfigInterface
;
use
Drupal\field\FieldInstanceConfigInterface
;
...
...
@@ -165,7 +166,7 @@ protected function loadFieldItems(array $entities) {
}
}
$cid
=
"field:
{
$this
->
entityTypeId
}
:
$id
"
;
\
Drupal
::
cache
(
'entity'
)
->
set
(
$cid
,
$data
);
\
Drupal
::
cache
(
'entity'
)
->
set
(
$cid
,
$data
,
Cache
::
PERMANENT
,
array
(
'entity_field_info'
=>
TRUE
)
);
}
}
}
...
...
core/lib/Drupal/Core/Entity/EntityManager.php
View file @
00339b3d
...
...
@@ -21,6 +21,7 @@
use
Drupal\Core\StringTranslation\StringTranslationTrait
;
use
Drupal\Core\StringTranslation\TranslationInterface
;
use
Drupal\Core\TypedData\TranslatableInterface
;
use
Drupal\Core\TypedData\TypedDataManager
;
use
Symfony\Component\DependencyInjection\ContainerAwareInterface
;
use
Symfony\Component\DependencyInjection\ContainerAwareTrait
;
...
...
@@ -95,6 +96,13 @@ class EntityManager extends DefaultPluginManager implements EntityManagerInterfa
*/
protected
$classResolver
;
/**
* The typed data manager.
*
* @var \Drupal\Core\TypedData\TypedDataManager
*/
protected
$typedDataManager
;
/**
* Static cache of bundle information.
*
...
...
@@ -136,7 +144,7 @@ class EntityManager extends DefaultPluginManager implements EntityManagerInterfa
* @param \Drupal\Core\DependencyInjection\ClassResolverInterface $class_resolver
* The class resolver.
*/
public
function
__construct
(
\
Traversable
$namespaces
,
ModuleHandlerInterface
$module_handler
,
CacheBackendInterface
$cache
,
LanguageManagerInterface
$language_manager
,
TranslationInterface
$translation_manager
,
ClassResolverInterface
$class_resolver
)
{
public
function
__construct
(
\
Traversable
$namespaces
,
ModuleHandlerInterface
$module_handler
,
CacheBackendInterface
$cache
,
LanguageManagerInterface
$language_manager
,
TranslationInterface
$translation_manager
,
ClassResolverInterface
$class_resolver
,
TypedDataManager
$typed_data_manager
)
{
parent
::
__construct
(
'Entity'
,
$namespaces
,
$module_handler
,
'Drupal\Core\Entity\Annotation\EntityType'
);
$this
->
setCacheBackend
(
$cache
,
$language_manager
,
'entity_type:'
,
array
(
'entity_types'
=>
TRUE
));
...
...
@@ -144,6 +152,7 @@ public function __construct(\Traversable $namespaces, ModuleHandlerInterface $mo
$this
->
translationManager
=
$translation_manager
;
$this
->
classResolver
=
$class_resolver
;
$this
->
typedDataManager
=
$typed_data_manager
;
}
/**
...
...
@@ -151,10 +160,8 @@ public function __construct(\Traversable $namespaces, ModuleHandlerInterface $mo
*/
public
function
clearCachedDefinitions
()
{
parent
::
clearCachedDefinitions
();
$this
->
bundleInfo
=
NULL
;
$this
->
displayModeInfo
=
array
();
$this
->
extraFields
=
array
();
$this
->
clearCachedBundles
();
$this
->
clearCachedFieldDefinitions
();
}
/**
...
...
@@ -591,7 +598,22 @@ public function clearCachedFieldDefinitions() {
$this
->
fieldDefinitions
=
array
();
$this
->
fieldStorageDefinitions
=
array
();
$this
->
fieldMap
=
array
();
$this
->
displayModeInfo
=
array
();
$this
->
extraFields
=
array
();
Cache
::
deleteTags
(
array
(
'entity_field_info'
=>
TRUE
));
// The typed data manager statically caches prototype objects with injected
// definitions, clear those as well.
$this
->
typedDataManager
->
clearCachedDefinitions
();
}
/**
* {@inheritdoc}
*/
public
function
clearCachedBundles
()
{
$this
->
bundleInfo
=
array
();
Cache
::
deleteTags
(
array
(
'entity_bundles'
=>
TRUE
));
// Entity bundles are exposed as data types, clear that cache too.
$this
->
typedDataManager
->
clearCachedDefinitions
();
}
/**
...
...
@@ -606,7 +628,7 @@ public function getBundleInfo($entity_type) {
* {@inheritdoc}
*/
public
function
getAllBundleInfo
()
{
if
(
!
isset
(
$this
->
bundleInfo
))
{
if
(
empty
(
$this
->
bundleInfo
))
{
$langcode
=
$this
->
languageManager
->
getCurrentLanguage
()
->
id
;
if
(
$cache
=
$this
->
cacheBackend
->
get
(
"entity_bundle_info:
$langcode
"
))
{
$this
->
bundleInfo
=
$cache
->
data
;
...
...
@@ -629,7 +651,7 @@ public function getAllBundleInfo() {
}
}
$this
->
moduleHandler
->
alter
(
'entity_bundle_info'
,
$this
->
bundleInfo
);
$this
->
cacheBackend
->
set
(
"entity_bundle_info:
$langcode
"
,
$this
->
bundleInfo
,
Cache
::
PERMANENT
,
array
(
'entity_types'
=>
TRUE
));
$this
->
cacheBackend
->
set
(
"entity_bundle_info:
$langcode
"
,
$this
->
bundleInfo
,
Cache
::
PERMANENT
,
array
(
'entity_types'
=>
TRUE
,
'entity_bundles'
=>
TRUE
));
}
}
...
...
@@ -786,7 +808,7 @@ protected function getAllDisplayModesByEntityType($display_type) {
$this
->
displayModeInfo
[
$display_type
][
$display_mode_entity_type
][
$display_mode_name
]
=
(
array
)
$display_mode
;
}
$this
->
moduleHandler
->
alter
(
$key
,
$this
->
displayModeInfo
[
$display_type
]);
$this
->
cacheBackend
->
set
(
"
$key
:
$langcode
"
,
$this
->
displayModeInfo
[
$display_type
],
CacheBackendInterface
::
CACHE_PERMANENT
,
array
(
'entity_types'
=>
TRUE
));
$this
->
cacheBackend
->
set
(
"
$key
:
$langcode
"
,
$this
->
displayModeInfo
[
$display_type
],
CacheBackendInterface
::
CACHE_PERMANENT
,
array
(
'entity_types'
=>
TRUE
,
'entity_field_info'
=>
TRUE
));
}
}
...
...
core/lib/Drupal/Core/Entity/EntityManagerInterface.php
View file @
00339b3d
...
...
@@ -142,6 +142,16 @@ public function getAllBundleInfo();
*/
public
function
clearCachedDefinitions
();
/**
* Clears static and persistent field definition caches.
*/
public
function
clearCachedFieldDefinitions
();
/**
* Clears static and persistent bundles.
*/
public
function
clearCachedBundles
();
/**
* Creates a new view builder instance.
*
...
...
@@ -177,11 +187,6 @@ public function getListBuilder($entity_type);
*/
public
function
getFormObject
(
$entity_type
,
$operation
);
/**
* Clears static and persistent field definition caches.
*/
public
function
clearCachedFieldDefinitions
();
/**
* Checks whether a certain entity type has a certain controller.
*
...
...
core/lib/Drupal/Core/Field/FieldDefinitionInterface.php
View file @
00339b3d
...
...
@@ -119,7 +119,8 @@ public function isRequired();
*
* @return mixed
* The default value for the field, as accepted by
* Drupal\field\Plugin\Core\Entity\Field::setValue(). This can be either:
* Drupal\field\Plugin\Core\Entity\FieldConfig::setValue(). This can be
* either:
* - a literal, in which case it will be assigned to the first property of
* the first item.
* - a numerically indexed array of items, each item being a property/value
...
...
core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTypeTest.php
View file @
00339b3d
...
...
@@ -91,7 +91,6 @@ public function testCustomBlockTypeEditing() {
'label'
=>
'Bar'
,
);
$this
->
drupalPostForm
(
'admin/structure/block/custom-blocks/manage/basic'
,
$edit
,
t
(
'Save'
));
field_info_cache_clear
();
$this
->
drupalGet
(
'block/add'
);
$this
->
assertRaw
(
'Bar'
,
'New name was displayed.'
);
...
...
core/modules/comment/comment.install
View file @
00339b3d
...
...
@@ -12,7 +12,6 @@ function comment_uninstall() {
// Remove the comment fields.
$fields
=
entity_load_multiple_by_properties
(
'field_config'
,
array
(
'type'
=>
'comment'
));
foreach
(
$fields
as
$field
)
{
entity_invoke_bundle_hook
(
'delete'
,
'comment'
,
$field
->
entity_type
.
'__'
.
$field
->
name
);
$field
->
delete
();
}
...
...
core/modules/comment/comment.module
View file @
00339b3d
...
...
@@ -13,6 +13,7 @@
use
Drupal\comment\CommentInterface
;
use
Drupal\comment\Entity\Comment
;
use
Drupal\comment\Plugin\Field\FieldType\CommentItemInterface
;
use
Drupal\Core\Entity\ContentEntityInterface
;
use
Drupal\Core\Entity\EntityInterface
;
use
Drupal\entity\Entity\EntityViewDisplay
;
use
Drupal\Core\Entity\Display\EntityViewDisplayInterface
;
...
...
@@ -256,6 +257,16 @@ function comment_field_config_delete(FieldConfigInterface $field) {
}
}
/**
* Implements hook_ENTITY_TYPE_insert() for 'field_config'.
*/
function
comment_field_config_insert
(
FieldConfigInterface
$field
)
{
if
(
$field
->
getType
()
==
'comment'
)
{
// Delete all fields and displays attached to the comment bundle.
entity_invoke_bundle_hook
(
'insert'
,
'comment'
,
$field
->
getTargetEntityTypeId
()
.
'__'
.
$field
->
getName
());
}
}
/**
* Implements hook_ENTITY_TYPE_delete() for 'field_instance_config'.
*/
...
...
@@ -300,7 +311,7 @@ function comment_permission() {
* Number of comments.
* @param int $new_replies
* Number of new replies.
* @param \Drupal\Core\Entity\EntityInterface $entity
* @param \Drupal\Core\Entity\
Content
EntityInterface $entity
* The first new comment entity.
* @param string $field_name
* The field name on the entity to which comments are attached to.
...
...
@@ -308,10 +319,10 @@ function comment_permission() {
* @return array|null
* An array "page=X" if the page number is greater than zero; NULL otherwise.
*/
function
comment_new_page_count
(
$num_comments
,
$new_replies
,
EntityInterface
$entity
,
$field_name
=
'comment'
)
{
$
instance
=
\
Drupal
::
service
(
'field.info'
)
->
getInstance
(
$entity
->
getEntityTypeId
(),
$entity
->
bundle
(),
$field_name
);
$mode
=
$
instance
->
getSetting
(
'default_mode'
);
$comments_per_page
=
$
instance
->
getSetting
(
'per_page'
);
function
comment_new_page_count
(
$num_comments
,
$new_replies
,
Content
EntityInterface
$entity
,
$field_name
=
'comment'
)
{
$
field_definition
=
$entity
->
getFieldDefinition
(
$field_name
);
$mode
=
$
field_definition
->
getSetting
(
'default_mode'
);
$comments_per_page
=
$
field_definition
->
getSetting
(
'per_page'
);
$pagenum
=
NULL
;
$flat
=
$mode
==
COMMENT_MODE_FLAT
?
TRUE
:
FALSE
;
if
(
$num_comments
<=
$comments_per_page
)
{
...
...
@@ -960,9 +971,9 @@ function comment_node_update_index(EntityInterface $node, $langcode) {
if
(
!
$node
->
hasField
(
$field_name
))
{
continue
;
}
$
instance
=
\
Drupal
::
service
(
'field.info'
)
->
getInstance
(
'node'
,
$node
->
getType
(),
$field_name
);
$mode
=
$
instance
->
getSetting
(
'default_mode'
);
$comments_per_page
=
$
instance
->
getSetting
(
'per_page'
);
$
field_definition
=
$node
->
getFieldDefinition
(
$field_name
);
$mode
=
$
field_definition
->
getSetting
(
'default_mode'
);
$comments_per_page
=
$
field_definition
->
getSetting
(
'per_page'
);
if
(
$node
->
get
(
$field_name
)
->
status
&&
$cids
=
comment_get_thread
(
$node
,
$field_name
,
$mode
,
$comments_per_page
))
{
$comments
=
entity_load_multiple
(
'comment'
,
$cids
);
comment_prepare_thread
(
$comments
);
...
...
core/modules/comment/lib/Drupal/comment/CommentForm.php
View file @
00339b3d
...
...
@@ -45,8 +45,6 @@ public static function create(ContainerInterface $container) {
*
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager service.
* @param \Drupal\field\FieldInfo $field_info
* The field info service.
* @param \Drupal\Core\Session\AccountInterface $current_user
* The current user.
*/
...
...
core/modules/comment/lib/Drupal/comment/CommentViewBuilder.php
View file @
00339b3d
...
...
@@ -59,8 +59,6 @@ public static function createInstance(ContainerInterface $container, EntityTypeI
* The entity manager service.
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager.
* @param \Drupal\field\FieldInfo $field_info
* The field info service.
* @param \Drupal\Core\Access\CsrfTokenGenerator $csrf_token
* The CSRF token manager service.
*/
...
...
core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php
View file @
00339b3d
...
...
@@ -8,6 +8,8 @@
namespace
Drupal\comment\Tests
;
use
Drupal\comment\Plugin\Field\FieldType\CommentItemInterface
;
use
Drupal\field\Entity\FieldConfig
;
use
Drupal\field\Entity\FieldInstanceConfig
;
/**
* Tests fields on comments.
...
...
@@ -39,13 +41,13 @@ function testCommentDefaultFields() {
$this
->
container
->
get
(
'comment.manager'
)
->
addDefaultField
(
'node'
,
'test_node_type'
);
// Check that the 'comment_body' field is present on the comment bundle.
$instance
=
$this
->
container
->
get
(
'field.info'
)
->
getInstanc
e
(
'comment'
,
'node__comment'
,
'comment_body'
);
$instance
=
FieldInstanceConfig
::
loadByNam
e
(
'comment'
,
'node__comment'
,
'comment_body'
);
$this
->
assertTrue
(
!
empty
(
$instance
),
'The comment_body field is added when a comment bundle is created'
);
$instance
->
delete
();
// Check that the 'comment_body' field is deleted.
$field
=
$this
->
container
->
get
(
'field.info'
)
->
getField
(
'comment'
,
'comment_body'
);
$field
=
FieldConfig
::
loadByName
(
'comment'
,
'comment_body'
);
$this
->
assertTrue
(
empty
(
$field
),
'The comment_body field was deleted'
);
// Create a new content type.
...
...
@@ -55,10 +57,10 @@ function testCommentDefaultFields() {
// Check that the 'comment_body' field exists and has an instance on the
// new comment bundle.
$field
=
$this
->
container
->
get
(
'field.info'
)
->
getField
(
'comment'
,
'comment_body'
);
$field
=
FieldConfig
::
loadByName
(
'comment'
,
'comment_body'
);
$this
->
assertTrue
(
$field
,
'The comment_body field exists'
);
$instance
s
=
$this
->
container
->
get
(
'field.info'
)
->
getInstances
(
'comment'
);
$this
->
assertTrue
(
isset
(
$instance
s
[
'node__comment'
][
'comment_body'
]
),
format_string
(
'The comment_body field is present for comments on type @type'
,
array
(
'@type'
=>
$type_name
)));
$instance
=
FieldInstanceConfig
::
loadByName
(
'comment'
,
'node__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
);
...
...
@@ -75,8 +77,8 @@ function testCommentInstallAfterContentModule() {
$this
->
drupalLogin
(
$this
->
admin_user
);
// Drop default comment field added in CommentTestBase::setup().
entity_load
(
'field_config'
,
'node.
comment'
)
->
delete
();
if
(
$field
=
$this
->
container
->
get
(
'field.info'
)
->
getField
(
'node'
,
'comment_node_forum'
))
{
FieldConfig
::
loadByName
(
'node'
,
'
comment'
)
->
delete
();
if
(
$field
=
FieldConfig
::
loadByName
(
'node'
,
'comment_node_forum'
))
{
$field
->
delete
();
}
...
...
core/modules/comment/lib/Drupal/comment/Tests/CommentNonNodeTest.php
View file @
00339b3d
...
...
@@ -9,6 +9,7 @@
use
Drupal\comment\CommentInterface
;
use
Drupal\comment\Plugin\Field\FieldType\CommentItemInterface
;
use
Drupal\field\Entity\FieldInstanceConfig
;
use
Drupal\simpletest\WebTestBase
;
use
Drupal\Core\Entity\EntityInterface
;
...
...
@@ -92,7 +93,7 @@ function postComment(EntityInterface $entity, $comment, $subject = '', $contact
$edit
=
array
();
$edit
[
'comment_body[0][value]'
]
=
$comment
;
$instance
=
$this
->
container
->
get
(
'field.info'
)
->
getInstanc
e
(
'entity_test'
,
'entity_test'
,
'comment'
);
$instance
=
FieldInstanceConfig
::
loadByNam
e
(
'entity_test'
,
'entity_test'
,
'comment'
);
$preview_mode
=
$instance
->
getSetting
(
'preview'
);
$subject_mode
=
$instance
->
getSetting
(
'subject'
);
...
...
core/modules/comment/lib/Drupal/comment/Tests/CommentPagerTest.php
View file @
00339b3d
...
...
@@ -261,6 +261,7 @@ function testCommentNewPageIndicator() {
6
=>
0
,
// Page of comment 0
);
\
Drupal
::
entityManager
()
->
getStorage
(
'node'
)
->
resetCache
(
array
(
$node
->
id
()));
$node
=
node_load
(
$node
->
id
());
foreach
(
$expected_pages
as
$new_replies
=>
$expected_page
)
{
$returned
=
comment_new_page_count
(
$node
->
get
(
'comment'
)
->
comment_count
,
$new_replies
,
$node
);
...
...
core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php
View file @
00339b3d
...
...
@@ -9,6 +9,7 @@
use
Drupal\Core\Language\Language
;
use
Drupal\comment\CommentInterface
;
use
Drupal\field\Entity\FieldInstanceConfig
;
use
Drupal\simpletest\WebTestBase
;
/**
...
...
@@ -105,10 +106,10 @@ public function postComment($entity, $comment, $subject = '', $contact = NULL, $
$edit
[
'comment_body[0][value]'
]
=
$comment
;
if
(
$entity
!==
NULL
)
{
$instance
=
$this
->
container
->
get
(
'field.info'
)
->
getInstanc
e
(
'node'
,
$entity
->
bundle
(),
$field_name
);
$instance
=
FieldInstanceConfig
::
loadByNam
e
(
'node'
,
$entity
->
bundle
(),
$field_name
);
}
else
{
$instance
=
$this
->
container
->
get
(
'field.info'
)
->
getInstanc
e
(
'node'
,
'article'
,
$field_name
);
$instance
=
FieldInstanceConfig
::
loadByNam
e
(
'node'
,
'article'
,
$field_name
);
}
$preview_mode
=
$instance
->
settings
[
'preview'
];
$subject_mode
=
$instance
->
settings
[
'subject'
];
...
...
@@ -295,7 +296,7 @@ public function setCommentsPerPage($number, $field_name = 'comment') {
* Defaults to 'comment'.
*/
public
function
setCommentSettings
(
$name
,
$value
,
$message
,
$field_name
=
'comment'
)
{
$instance
=
$this
->
container
->
get
(
'field.info'
)
->
getInstanc
e
(
'node'
,
'article'
,
$field_name
);
$instance
=
FieldInstanceConfig
::
loadByNam
e
(
'node'
,
'article'
,
$field_name
);
$instance
->
settings
[
$name
]
=
$value
;
$instance
->
save
();
// Display status message.
...
...
core/modules/comment/lib/Drupal/comment/Tests/CommentTranslationUITest.php
View file @
00339b3d
...
...
@@ -60,8 +60,6 @@ function setupBundle() {
$this
->
container
->
get
(
'comment.manager'
)
->
addDefaultField
(
'node'
,
'page'
,
'comment'
);
// Mark this bundle as translatable.
content_translation_set_config
(
'comment'
,
'node__comment_article'
,
'enabled'
,
TRUE
);
// Refresh entity info.
entity_info_cache_clear
();
}
/**
...
...
core/modules/config/lib/Drupal/config/Tests/ConfigImportAllTest.php
View file @
00339b3d
...
...
@@ -66,11 +66,9 @@ public function testInstallUninstall() {
// Delete every field on the site so all modules can be uninstalled. For
// example, if a comment field exists then module becomes required and can
// not be uninstalled.
$fields
=
\
Drupal
::
service
(
'field.info'
)
->
getFields
();
foreach
(
$fields
as
$field
)
{
entity_invoke_bundle_hook
(
'delete'
,
$field
->
entity_type
,
$field
->
entity_type
.
'__'
.
$field
->
name
);
$field
->
delete
();
}
$fields
=
\
Drupal
::
entityManager
()
->
getStorage
(
'field_config'
)
->
loadMultiple
();
\
Drupal
::
entityManager
()
->
getStorage
(
'field_config'
)
->
delete
(
$fields
);
// Purge the data.
field_purge_batch
(
1000
);
...
...
core/modules/content_translation/content_translation.module
View file @
00339b3d
...
...
@@ -816,7 +816,7 @@ function content_translation_language_configuration_element_submit(array $form,
if
(
content_translation_enabled
(
$context
[
'entity_type'
],
$context
[
'bundle'
])
!=
$enabled
)
{
content_translation_set_config
(
$context
[
'entity_type'
],
$context
[
'bundle'
],
'enabled'
,
$enabled
);
entity_info_cache_clear
();
\
Drupal
::
entityManager
()
->
clearCachedDefinitions
();
\
Drupal
::
service
(
'router.builder'
)
->
setRebuildNeeded
();
}
}
...
...
@@ -884,6 +884,6 @@ function content_translation_save_settings($settings) {
}
// Ensure entity and menu router information are correctly rebuilt.
entity_info_cache_clear
();
\
Drupal
::
entityManager
()
->
clearCachedDefinitions
();
\
Drupal
::
service
(
'router.builder'
)
->
setRebuildNeeded
();
}
core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSettingsTest.php
View file @
00339b3d
...
...
@@ -94,7 +94,6 @@ function testSettingsUI() {
'settings[comment][node__comment_article][fields][comment_body]'
=>
TRUE
,
);
$this
->
assertSettings
(
'comment'
,
'node__comment_article'
,
TRUE
,
$edit
);
field_info_cache_clear
();
$field
=
FieldConfig
::
loadByName
(
'comment'
,
'comment_body'
);
$this
->
assertTrue
(
$field
->
isTranslatable
(),
'Comment body is translatable.'
);
...
...
@@ -143,8 +142,7 @@ function testSettingsUI() {
$translatable
=
!
$translatable
;
$edit
=
array
(
'field[translatable]'
=>
$translatable
);
$this
->
drupalPostForm
(
'admin/structure/types/manage/article/fields/node.article.body/field'
,
$edit
,
t
(
'Save field settings'
));
field_info_cache_clear
();
entity_info_cache_clear
();
\
Drupal
::
entityManager
()
->
clearCachedFieldDefinitions
();
$field
=
FieldConfig
::
loadByName
(
'node'
,
'body'
);
$definitions
=
\
Drupal
::
entityManager
()
->
getFieldDefinitions
(
'node'
,
'article'
);
$this
->
assertEqual
(
$definitions
[
'body'
]
->
isTranslatable
(),
$translatable
,
'Field translatability correctly switched.'
);
...
...
@@ -171,8 +169,7 @@ protected function assertSettings($entity_type, $bundle, $enabled, $edit) {
$this
->
drupalPostForm
(
'admin/config/regional/content-language'
,
$edit
,
t
(
'Save'
));
$args
=
array
(
'@entity_type'
=>
$entity_type
,
'@bundle'
=>
$bundle
,
'@enabled'
=>
$enabled
?
'enabled'
:
'disabled'
);
$message
=
format_string
(
'Translation for entity @entity_type (@bundle) is @enabled.'
,
$args
);
field_info_cache_clear
();
entity_info_cache_clear
();
\
Drupal
::
entityManager
()
->
clearCachedDefinitions
();
return
$this
->
assertEqual
(
content_translation_enabled
(
$entity_type
,
$bundle
),
$enabled
,
$message
);
}
...
...
Prev
1
2
3
4
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment