protected function FieldCollectionEntityTranslationTestCase::removeTranslation in Field collection 7
Removes a translation programmatically using the entity translation api.
Parameters
mixed $node: The node to remove the translation from.
string $langcode: The language of the translation to remove.
1 call to FieldCollectionEntityTranslationTestCase::removeTranslation()
- FieldCollectionEntityTranslationTestCase::testEntityTranslation in ./
field_collection.test - Ensures the right behaviour in all Entity Translation use cases.
File
- ./
field_collection.test, line 1069 - Tests for field_collections.
Class
- FieldCollectionEntityTranslationTestCase
- Test using field collection with content that gets translated with Entity Translation.
Code
protected function removeTranslation($node, $langcode) {
// Get a translation entity handler.
$handler = entity_translation_get_handler('node', $node, TRUE);
// Remove the translation.
$handler
->removeTranslation($langcode);
node_save($node);
// Reload and return the node.
$node = node_load($node->nid, NULL, TRUE);
return $node;
}