Issue #2895124 by xjm, lauriii, joaopauloc.dev, Berdir: Field storage settings...
Issue #2895124 by xjm, lauriii, joaopauloc.dev, Berdir: Field storage settings give a scary red warning that they can't be changed when the cardinality is the only thing with restrictions
$form['#prefix']='<p>'.$this->t('These settings apply to the %field field everywhere it is used. These settings impact the way that data is stored in the database and cannot be changed once data has been created.',['%field'=>$field_label]).'</p>';
// See if data already exists for this field.
// If so, prevent changes to the field settings.
if($this->entity->hasData()){
$form['#prefix']='<div class="messages messages--error">'.$this->t('There is data for this field in the database. The field settings can no longer be changed.').'</div>'.$form['#prefix'];
}
$form['#prefix']='<p>'.$this->t('These settings apply to the %field field everywhere it is used. Some also impact the way that data is stored and cannot be changed once data has been created.',['%field'=>$field_label]).'</p>';
// Add settings provided by the field module. The field module is
// responsible for not returning settings that cannot be changed if
@@ -203,7 +197,7 @@ public function validateCardinality(array &$element, FormStateInterface $form_st
->count()
->execute();
if($entities_with_higher_delta){
$form_state->setError($element['cardinality_number'],$this->formatPlural($entities_with_higher_delta,'There is @count entity with @delta or more values in this field.','There are @count entities with @delta or more values in this field.',['@delta'=>$form_state->getValue('cardinality')+1]));
$form_state->setError($element['cardinality_number'],$this->formatPlural($entities_with_higher_delta,'There is @count entity with @delta or more values in this field, so the allowed number of values cannot be set to @allowed.','There are @count entities with @delta or more values in this field, so the allowed number of values cannot be set to @allowed.',['@delta'=>$form_state->getValue('cardinality')+1,'@allowed'=>$form_state->getValue('cardinality')]));