You are here

function webform_webform_update in Webform 8.5

Same name and namespace in other branches
  1. 6.x includes/webform.editor.inc \webform_webform_update()

Implements hook_webform_update().

See also

editor_entity_update()

File

includes/webform.editor.inc, line 41
Webform module editor file upload hooks.

Code

function webform_webform_update(WebformInterface $webform) {
  $original_uuids = _webform_get_config_entity_file_uuids($webform->original);
  $uuids = _webform_get_config_entity_file_uuids($webform);

  // Detect file usages that should be incremented.
  $added_files = array_diff($uuids, $original_uuids);
  _webform_record_file_usage($added_files, $webform
    ->getEntityTypeId(), $webform
    ->id());

  // Detect file usages that should be decremented.
  $removed_files = array_diff($original_uuids, $uuids);
  _webform_delete_file_usage($removed_files, $webform
    ->getEntityTypeId(), $webform
    ->id(), 1);
}