You are here

public function CpfItem::setValue in CPF 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/Field/FieldType/CpfItem.php \Drupal\cpf\Plugin\Field\FieldType\CpfItem::setValue()

Overrides \Drupal\Core\TypedData\TypedData::setValue().

Parameters

array|null $values: An array of property values.

Overrides FieldItemBase::setValue

File

src/Plugin/Field/FieldType/CpfItem.php, line 181
Contains \Drupal\cpf\Plugin\Field\FieldType\CpfItem.

Class

CpfItem
Plugin implementation of the 'cpf' field type.

Namespace

Drupal\cpf\Plugin\Field\FieldType

Code

public function setValue($values, $notify = TRUE) {

  // Remove all characters except numbers.
  $values['value'] = $this->cpfService
    ->digits($values['value']);
  parent::setValue($values, $notify);
}