$form['author'
]['name'
]['#states'
] =
[ 'visible' =>
[ ':input[name="uid"]' =>
['empty' => TRUE
],
],
];
} // Add author email and homepage fields depending on the current user.
$form['author'
]['mail'
] =
[ '#type' => 'email',
'#title' =>
$this->
t('Email'
),
'#default_value' =>
$comment->
getAuthorEmail(),
'#required'
=> ($this->currentUser->
isAnonymous() &&
$anonymous_contact == CommentInterface::ANONYMOUS_MUST_CONTACT
),
'#maxlength' => 64,
'#size' => 30,
'#description' =>
$this->
t('The content of this field is kept private and will not be shown publicly.'
),
'#access'
=> ($comment->
getOwner()->
isAnonymous() &&
$is_admin) || ($this->currentUser->
isAnonymous() &&
$anonymous_contact != CommentInterface::ANONYMOUS_MAYNOT_CONTACT
),
];
$form['author'
]['homepage'
] =
[ '#type' => 'url',
'#title' =>
$this->
t('Homepage'
),
'#default_value' =>
$comment->
getHomepage(),