You are here

public function MinisiteItem::delete in Mini site 8

Defines custom delete behavior for field values.

This method is called during the process of deleting an entity, just before values are deleted from storage.

Overrides FieldItemBase::delete

File

src/Plugin/Field/FieldType/MinisiteItem.php, line 208

Class

MinisiteItem
Plugin implementation of the Minisite field type.

Namespace

Drupal\minisite\Plugin\Field\FieldType

Code

public function delete() {

  // This will fire once the parent entity is removed.

  /** @var \Drupal\Core\Field\FieldItemList $item_list */
  $item_list = $this
    ->getParent();
  if (!$item_list
    ->isEmpty()) {
    $this
      ->deleteMinisite($item_list);
  }
}