Skip to content

Commit

Permalink
updating block admin enque
Browse files Browse the repository at this point in the history
  • Loading branch information
iruzevic committed Jan 17, 2024
1 parent 513fb4c commit 4dfc617
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/Helpers/UtilsHooksHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,34 @@ final class UtilsHooksHelper
* Get public filter name.
*
* @param array<int, string> $names Array of names.
* @param array<mixed> $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<int, string> $names Array of names.
* @param array<mixed> $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);
}

/**
Expand Down

0 comments on commit 4dfc617

Please sign in to comment.