Updates the hook for both forward and backward compatibility.
See https://github.com/civicrm/civicrm-core/pull/25101