You are here

public function DurationField::setValue in Duration Field 8

Sets the value of the field.

Overrides FieldItemBase::setValue

File

src/Plugin/Field/FieldType/DurationField.php, line 108

Class

DurationField
Provides the 'duration' field type.

Namespace

Drupal\duration_field\Plugin\Field\FieldType

Code

public function setValue($values, $notify = TRUE) {
  if (is_array($values) && isset($values['value']) && is_array($values['value'])) {
    $values['value'] = DurationService::convertValue($values['value']);
  }
  parent::setValue($values, $notify);
}