public static function InlineEntityFormComplex::updateRowWeights in Inline Entity Form 8
Updates entity weights based on their weights in the widget.
File
- src/
Plugin/ Field/ FieldWidget/ InlineEntityFormComplex.php, line 927
Class
- InlineEntityFormComplex
- Complex inline widget.
Namespace
Drupal\inline_entity_form\Plugin\Field\FieldWidgetCode
public static function updateRowWeights($element, FormStateInterface $form_state, $form) {
$ief_id = $element['#ief_id'];
// Loop over the submitted delta values and update the weight of the entities
// in the form state.
foreach (Element::children($element['entities']) as $key) {
$form_state
->set([
'inline_entity_form',
$ief_id,
'entities',
$key,
'weight',
], $element['entities'][$key]['delta']['#value']);
}
}