You are here

public static function DateRecurInteractiveWidget::preRenderFormElement in Recurring Dates Field 8

File

src/Plugin/Field/FieldWidget/DateRecurInteractiveWidget.php, line 39

Class

DateRecurInteractiveWidget
Plugin implementation of the 'date_recur_interactive_widget' widget.

Namespace

Drupal\date_recur\Plugin\Field\FieldWidget

Code

public static function preRenderFormElement(array $element) {
  $keys = [
    'value',
    'end_value',
  ];
  $weight = 0;
  foreach ($keys as $key) {
    $element['date_group'][$key] = $element[$key];
    $element['date_group'][$key]['#weight'] = $weight;
    $weight += 2;
    unset($element[$key]);
  }
  return $element;
}