Skip to content
Snippets Groups Projects
Commit e82d8815 authored by Sourav Paul's avatar Sourav Paul
Browse files

Issue #3460201: D10.3.1 on decimal field with precision 20 no check appears

parent f515e856
No related branches found
No related tags found
1 merge request!2Issue #3460201: D10.3.1 on decimal field with precision 20 no check appears
......@@ -12,13 +12,12 @@ function precision_modifier_form_alter(&$form, FormStateInterface $form_state, $
$form_object = $form_state->getFormObject();
if ($form_object instanceof EntityForm && $form_id == 'field_storage_config_edit_form') {
if ($form_object instanceof EntityForm && $form_id == 'field_config_edit_form') {
$entity = $form_object->getEntity();
$hasData = $entity->hasData();
$fieldType = $entity->getType();
if ($fieldType == 'decimal' && $hasData) {
if ($fieldType == 'decimal' ) {
$precisionNumbers = range(10, 32);
$precision = [];
foreach ($precisionNumbers as $precisionNumber) {
......@@ -75,12 +74,13 @@ function precision_modifier_form_alter(&$form, FormStateInterface $form_state, $
}
function precision_modifier_field_storage_config_edit_form(array $form, FormStateInterface $form_state) {
if ($form_state->getValue('increase')) {
$field = $form_state->getValue('field');
$bundle = $form_state->getValue('content_type');
$field = $form_state->getFormObject()->getEntity();
$field_name = $field->getName();
$bundle = $field->getTargetBundle();
$precision = $form_state->getValue('precision');
$scale = $form_state->getValue('scale');
$precisionModifierService = Drupal::service('precision_modifier.default');
$precisionModifierService->increasePrecision($field, $bundle, $precision, $scale);
$precisionModifierService->increasePrecision($field_name, $bundle, $precision, $scale);
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment