Mercurial > hg > isophonics-drupal-site
diff core/modules/system/src/Tests/Entity/EntityDefinitionTestTrait.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children | 129ea1e6d783 |
line wrap: on
line diff
--- a/core/modules/system/src/Tests/Entity/EntityDefinitionTestTrait.php Mon Apr 23 09:33:26 2018 +0100 +++ b/core/modules/system/src/Tests/Entity/EntityDefinitionTestTrait.php Mon Apr 23 09:46:53 2018 +0100 @@ -111,12 +111,19 @@ * * @param string $type * (optional) The field type for the new field. Defaults to 'string'. + * @param string $entity_type_id + * (optional) The entity type ID the base field should be attached to. + * Defaults to 'entity_test_update'. + * @param bool $is_revisionable + * (optional) If the base field should be revisionable or not. Defaults to + * FALSE. */ - protected function addBaseField($type = 'string') { + protected function addBaseField($type = 'string', $entity_type_id = 'entity_test_update', $is_revisionable = FALSE) { $definitions['new_base_field'] = BaseFieldDefinition::create($type) ->setName('new_base_field') + ->setRevisionable($is_revisionable) ->setLabel(t('A new base field')); - $this->state->set('entity_test_update.additional_base_field_definitions', $definitions); + $this->state->set($entity_type_id . '.additional_base_field_definitions', $definitions); } /** @@ -167,9 +174,12 @@ /** * Removes the new base field from the 'entity_test_update' entity type. + * + * @param string $entity_type_id + * (optional) The entity type ID the base field should be attached to. */ - protected function removeBaseField() { - $this->state->delete('entity_test_update.additional_base_field_definitions'); + protected function removeBaseField($entity_type_id = 'entity_test_update') { + $this->state->delete($entity_type_id . '.additional_base_field_definitions'); } /**