From 4dfc6176f7baf24444dfc3bb17b496df9a911c0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Ruz=CC=8Cevic=CC=81?= Date: Wed, 17 Jan 2024 18:46:03 +0100 Subject: [PATCH] updating block admin enque --- src/Helpers/UtilsHooksHelper.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) 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); } /**