You are here

public function OfficeHoursListWidget::massageFormValues in Office Hours 8

This function repairs the anomaly we mentioned before.

Overrides OfficeHoursWidgetBase::massageFormValues

See also

formElement()

File

src/Plugin/Field/FieldWidget/OfficeHoursListWidget.php, line 68

Class

OfficeHoursListWidget
Plugin implementation of the 'office_hours_week' widget.

Namespace

Drupal\office_hours\Plugin\Field\FieldWidget

Code

public function massageFormValues(array $values, array $form, FormStateInterface $form_state) {

  // Reformat the $values, before passing to database.
  foreach ($values as &$item) {
    $item = $item['value'];
  }
  $values = parent::massageFormValues($values, $form, $form_state);
  return $values;
}