You are here

public function IssueItem::setValue in Simplenews 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldType/IssueItem.php \Drupal\simplenews\Plugin\Field\FieldType\IssueItem::setValue()
  2. 3.x src/Plugin/Field/FieldType/IssueItem.php \Drupal\simplenews\Plugin\Field\FieldType\IssueItem::setValue()

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

Parameters

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

Overrides EntityReferenceItem::setValue

File

src/Plugin/Field/FieldType/IssueItem.php, line 104

Class

IssueItem
Defines the 'issue' entity field type (extended entity_reference).

Namespace

Drupal\simplenews\Plugin\Field\FieldType

Code

public function setValue($values, $notify = TRUE) {
  if (count($values) == 1 && isset($values['target_id'])) {
    $values = array_merge($this->values, $values);
    if (!isset($values['handler']) || $values['handler'] == NULL) {
      $values['handler'] = 'simplenews_all';
    }
    if (!isset($values['status']) || $values['status'] == NULL) {
      $values['status'] = 0;
    }
    if (!isset($values['sent_count']) || $values['sent_count'] == NULL) {
      $values['sent_count'] = 0;
    }
    if (!isset($values['subscribers']) || $values['subscribers'] == NULL) {
      $values['subscribers'] = 0;
    }
  }
  parent::setValue($values, $notify);

  // TODO: Change the autogenerated stub
}