Filter
uncanny-automator
automator_logs_header_tabs
Filters the available tabs in the Uncanny Automator logs admin area.
add_filter( 'automator_logs_header_tabs', $callback, 10, 1 );
Description
Filters the available tabs displayed in the Uncanny Automator logs header. Developers can add, remove, or modify tab slugs and their corresponding translated labels to customize the logs view interface. This allows for the integration of custom log types or modification of existing ones.
Usage
add_filter( 'automator_logs_header_tabs', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
<?php
/**
* Example of adding a custom log tab to the Uncanny Automator logs header.
*
* This function will be hooked into the 'automator_logs_header_tabs' filter.
* It adds a new tab for 'Debugging logs' to the existing log tabs.
*
* @param array $tabs An array of existing log tabs.
* @return array The modified array of log tabs with the new custom tab added.
*/
function my_custom_automator_log_tabs( $tabs ) {
// Add a new tab with a unique key and a translatable title.
// The key 'my-custom-automator-debug-log' should be unique and descriptive.
// The value is the translated string that will be displayed as the tab label.
$tabs['my-custom-automator-debug-log'] = esc_html__( 'Debugging logs', 'my-text-domain' );
// Return the modified array of tabs.
return $tabs;
}
// Add the filter to the 'automator_logs_header_tabs' hook.
// The 'my_custom_automator_log_tabs' function will be called when the filter is applied.
// The second parameter specifies the callback function.
// The third parameter (optional) is the priority, and the fourth (optional) is the number of arguments accepted by the callback.
// In this case, the default priority is usually fine, and the callback accepts one argument (the $tabs array).
add_filter( 'automator_logs_header_tabs', 'my_custom_automator_log_tabs', 10, 1 );
?>
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
src/core/includes/recipe-logs-view.php:9
namespace Uncanny_Automator;
use Uncanny_AutomatorLogs_List_Table;
$current_tab = 'recipe-log';
$current = $current_tab;
$available_tabs = apply_filters(
'automator_logs_header_tabs',
array(
//'uncanny-automator-recipe-activity' => esc_attr__( 'Recipe activity', 'uncanny-automator' ),
'uncanny-automator-recipe-log' => esc_attr__( 'Recipe log', 'uncanny-automator' ),
'uncanny-automator-trigger-log' => esc_attr__( 'Trigger log', 'uncanny-automator' ),
'uncanny-automator-action-log' => esc_attr__( 'Action log', 'uncanny-automator' ),
)
Internal Usage
Found in src/core/admin/api-log/class-api-log.php:20:
add_filter( 'automator_logs_header_tabs', array( $this, 'register_tab' ) );