Chris@0: get('value')->getValue(); Chris@0: Chris@0: // Take into account that the name of the anonymous user is an empty string. Chris@0: if ($this->getEntity()->isAnonymous()) { Chris@0: return $value === NULL; Chris@0: } Chris@0: Chris@0: return $value === NULL || $value === ''; Chris@0: } Chris@0: Chris@14: /** Chris@14: * {@inheritdoc} Chris@14: */ Chris@14: public static function generateSampleValue(FieldDefinitionInterface $field_definition) { Chris@14: $values = parent::generateSampleValue($field_definition); Chris@14: // User names larger than 60 characters won't pass validation. Chris@14: $values['value'] = substr($values['value'], 0, UserInterface::USERNAME_MAX_LENGTH); Chris@14: return $values; Chris@14: } Chris@14: Chris@0: }