public function __construct(array
$values,
$entity_type = 'field_storage_config'
) { // Check required properties.
if (empty($values['field_name'
])) { throw new FieldException('Attempt to create a field storage without a field name.'
);
} if (!
preg_match('/^[_a-z]+[_a-z0-9]*$/',
$values['field_name'
])) { throw new FieldException("Attempt to create a field storage {
$values['field_name'
]} with invalid characters. Only lowercase alphanumeric characters and underscores are allowed, and only lowercase letters and underscore are allowed as the first character"
);
} if (empty($values['type'
])) { throw new FieldException("Attempt to create a field storage {
$values['field_name'
]} with no type."
);
} if (empty($values['entity_type'
])) { throw new FieldException("Attempt to create a field storage {
$values['field_name'
]} with no entity_type."
);
}