I have a link field in a content type, field_source. I created a computed field (field_source_domain) in the same content type, which should contain the domain for the link in field_source.
I tried with
$value = parse_url('https://subdomain.example.com/foo/bar', PHP_URL_HOST); and it works, but when I tried
$value = parse_url('$entity->field_source->value', PHP_URL_HOST); or
$value = parse_url('$fields['field_source']', PHP_URL_HOST);, I didn't get anything.
How do I get the domain name using a computed field?