I'm attempting to programmatically generate nodes of a custom content type from a form plugin. For most fields I don't have any trouble at all. For example for the title field I can set the value like so.
$node->title->value = t('My title'); $node->save();
However there is also a list(text) field that allows for multiple values. And I'm not sure how to go about saving values of field with multiple values. I'm assuming if there was only one value allowed I could do it just like I set the title in the previous example, but how do I deal with it when the field is an array? As a test I performed a die statement of the field on a node that already had values in that field to take a look at what it looks like and this was generated:
Array (  => Array ( [value] => test_3 )  => Array ( [value] => test_4 ) ) 1
But I'm not sure what to do with that. How would I set the field value of a list field with multiple values allowed?