Issue #1953770 by amateescu: Move the field-specific settings form elements at the top of the form.

8.0.x
Alex Pott 2014-10-30 14:48:06 +00:00
parent 7b10d499ce
commit 6061967bd1
1 changed files with 12 additions and 12 deletions

View File

@ -98,6 +98,18 @@ class FieldStorageEditForm extends FormBase {
$form['field_storage']['#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['field_storage']['#prefix'];
}
// Add settings provided by the field module. The field module is
// responsible for not returning settings that cannot be changed if
// the field already has data.
$form['field_storage']['settings'] = array(
'#weight' => -10,
);
// Create an arbitrary entity object, so that we can have an instantiated
// FieldItem.
$ids = (object) array('entity_type' => $this->field->entity_type, 'bundle' => $this->field->bundle, 'entity_id' => NULL);
$entity = _field_create_entity_from_ids($ids);
$form['field_storage']['settings'] += $entity->get($field_storage->getName())->first()->storageSettingsForm($form, $form_state, $field_storage->hasData());
// Build the configurable field values.
$cardinality = $field_storage->getCardinality();
$form['field_storage']['cardinality_container'] = array(
@ -141,18 +153,6 @@ class FieldStorageEditForm extends FormBase {
$form['field_storage']['module'] = array('#type' => 'value', '#value' => $field_storage->module);
$form['field_storage']['translatable'] = array('#type' => 'value', '#value' => $field_storage->isTranslatable());
// Add settings provided by the field module. The field module is
// responsible for not returning settings that cannot be changed if
// the field already has data.
$form['field_storage']['settings'] = array(
'#weight' => 10,
);
// Create an arbitrary entity object, so that we can have an instantiated
// FieldItem.
$ids = (object) array('entity_type' => $this->field->entity_type, 'bundle' => $this->field->bundle, 'entity_id' => NULL);
$entity = _field_create_entity_from_ids($ids);
$form['field_storage']['settings'] += $entity->get($field_storage->getName())->first()->storageSettingsForm($form, $form_state, $field_storage->hasData());
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array('#type' => 'submit', '#value' => $this->t('Save field settings'));
return $form;