FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED
);
// Add the media field to the form display.
\Drupal::
service('entity_display.repository'
)->
getFormDisplay('node', 'article'
) ->
setComponent('field_media',
['type' => 'media_library_widget'
]) ->
save();
// Create a file to user for our images.
$image = File::
create([ 'uri' =>
$this->
getTestFiles('image'
)[0
]->uri,
]);
$image->
setPermanent();
$image->
save();
// Create a translated and untranslated media item in each language.
// cSpell:disable
$media_items =
[ ['nl' => 'Eekhoorn', 'es' => 'Ardilla'
],
['es' => 'Zorro', 'nl' => 'Vos'
],
['nl' => 'Hert'
],
['es' => 'Tejón'
],
];
// cSpell:enable