public function UserNameItem::isEmpty in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/user/src/UserNameItem.php \Drupal\user\UserNameItem::isEmpty()
Determines whether the data structure is empty.
Return value
bool TRUE if the data structure is empty, FALSE otherwise.
Overrides StringItemBase::isEmpty
File
- core/
modules/ user/ src/ UserNameItem.php, line 20 - Contains \Drupal\user\UserNameItem.
Class
- UserNameItem
- Defines a custom field item class for the 'name' user entity field.
Namespace
Drupal\userCode
public function isEmpty() {
$value = $this
->get('value')
->getValue();
// Take into account that the name of the anonymous user is an empty string.
if ($this
->getEntity()
->isAnonymous()) {
return $value === NULL;
}
return $value === NULL || $value === '';
}