public function ParagraphsType::postSave

File

paragraphs/src/Entity/ParagraphsType.php, line 276

Class

ParagraphsType
Defines the ParagraphsType entity.

Namespace

Drupal\paragraphs\Entity

Code

public function postSave(EntityStorageInterface $storage, $update = TRUE) {
  if (!$update || $this->icon_uuid != $this->original->icon_uuid) {

    // Update the file usage for the icon file.
    $new_icon_file = $this->icon_uuid ? $this
      ->getFileByUuid($this->icon_uuid) : FALSE;

    // Update the file usage of the old icon as well if the icon was changed.
    $old_icon_file = $update && $this->original->icon_uuid ? $this
      ->getFileByUuid($this->original->icon_uuid) : FALSE;
    $this
      ->updateFileIconUsage($new_icon_file, $old_icon_file);
  }
  parent::postSave($storage, $update);
}