diff --git a/src/Helpers/UtilsHooksHelper.php b/src/Helpers/UtilsHooksHelper.php index 73c71e9..24cfb34 100644 --- a/src/Helpers/UtilsHooksHelper.php +++ b/src/Helpers/UtilsHooksHelper.php @@ -21,24 +21,34 @@ final class UtilsHooksHelper * Get public filter name. * * @param array $names Array of names. + * @param array $data Array of data. * * @return string */ - public static function getFilterName(array $names): string + public static function getFilterName(array $names, array $data = []): string { - return self::getHookName($names, 'filters', 'filter', \apply_filters(UtilsConfig::FILTER_PUBLIC_FILTERS_DATA, [])); + if (!$data) { + $data = \apply_filters(UtilsConfig::FILTER_PUBLIC_FILTERS_DATA, []); + } + + return self::getHookName($names, 'filters', 'filter', $data); } /** * Get public action name. * * @param array $names Array of names. + * @param array $data Array of data. * * @return string */ - public static function getActionName(array $names): string + public static function getActionName(array $names, array $data = []): string { - return self::getHookName($names, 'actions', 'action', \apply_filters(UtilsConfig::FILTER_PUBLIC_ACTIONS_DATA, [])); + if (!$data) { + $data = \apply_filters(UtilsConfig::FILTER_PUBLIC_ACTIONS_DATA, []); + } + + return self::getHookName($names, 'actions', 'action', $data); } /**