3 namespace Drupal\migrate\Plugin\migrate\destination;
5 use Drupal\migrate\Row;
8 * Provides entity base field override destination plugin.
10 * Base fields are non-configurable fields that always exist on a given entity
11 * type, like the 'title', 'created' and 'sticky' fields of the 'node' entity
12 * type. Some entity types can have bundles, for example the node content types.
13 * The base fields exist on all bundles but the bundles can override the
14 * definitions. For example, the label for node 'title' base field can be
15 * different on different content types.
19 * The example below migrates the node 'sticky' settings for each content type.
21 * id: d6_node_setting_sticky
22 * label: Node type 'sticky' setting
26 * plugin: d6_node_type
31 * entity_type: 'constants/entity_type'
33 * field_name: 'constants/field_name'
35 * plugin: default_value
36 * default_value: 'Sticky at the top of lists'
37 * 'default_value/0/value': 'options/sticky'
39 * plugin: entity:base_field_override
40 * migration_dependencies:
45 * @MigrateDestination(
46 * id = "entity:base_field_override"
49 class EntityBaseFieldOverride extends EntityConfigBase {
54 protected function getEntityId(Row $row) {
55 $entity_type = $row->getDestinationProperty('entity_type');
56 $bundle = $row->getDestinationProperty('bundle');
57 $field_name = $row->getDestinationProperty('field_name');
58 return "$entity_type.$bundle.$field_name";