You are here

public function PathItem::delete in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/path/src/Plugin/Field/FieldType/PathItem.php \Drupal\path\Plugin\Field\FieldType\PathItem::delete()

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

core/modules/path/src/Plugin/Field/FieldType/PathItem.php, line 83
Contains \Drupal\path\Plugin\Field\FieldType\PathItem.

Class

PathItem
Defines the 'path' entity field type.

Namespace

Drupal\path\Plugin\Field\FieldType

Code

public function delete() {

  // Delete all aliases associated with this entity.
  $entity = $this
    ->getEntity();
  \Drupal::service('path.alias_storage')
    ->delete(array(
    'source' => '/' . $entity
      ->urlInfo()
      ->getInternalPath(),
  ));
}