function PathFieldItemList::delete
Same name and namespace in other branches
- 9 core/modules/path/src/Plugin/Field/FieldType/PathFieldItemList.php \Drupal\path\Plugin\Field\FieldType\PathFieldItemList::delete()
- 10 core/modules/path/src/Plugin/Field/FieldType/PathFieldItemList.php \Drupal\path\Plugin\Field\FieldType\PathFieldItemList::delete()
- 11.x core/modules/path/src/Plugin/Field/FieldType/PathFieldItemList.php \Drupal\path\Plugin\Field\FieldType\PathFieldItemList::delete()
Overrides FieldItemList::delete
File
-
core/
modules/ path/ src/ Plugin/ Field/ FieldType/ PathFieldItemList.php, line 57
Class
- PathFieldItemList
- Represents a configurable entity path field.
Namespace
Drupal\path\Plugin\Field\FieldTypeCode
public function delete() {
// Delete all aliases associated with this entity in the current language.
$entity = $this->getEntity();
$path_alias_storage = \Drupal::entityTypeManager()->getStorage('path_alias');
$entities = $path_alias_storage->loadByProperties([
'path' => '/' . $entity->toUrl()
->getInternalPath(),
'langcode' => $entity->language()
->getId(),
]);
$path_alias_storage->delete($entities);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.