I have a multi-value textfield that stores the user agent string. I want to store the user agent every time the user logs in (this may not in fact be a good idea, but for sake of example).
The following code will save the user agent, but only in the first position. It replaces the old value instead of creating a new one.
function MYMODULE_user_login($account) {
$account->set("field_useragent", $_SERVER['HTTP_USER_AGENT']);
$account->save();
}
How can I add a new value each time this is called?