Action
Dynamic
uncanny-automator
automator_admin_logs_top_level_tabs_item_content_{dynamic}
> **Note:** This is a dynamic hook. The actual hook name is constructed at runtime. Fires to add custom content to specific tabs within the Automator admin logs.
add_action( 'automator_admin_logs_top_level_tabs_item_content_{dynamic}', $callback, 10, 1 );
Description
Fires after the tab panel content for a specific log tab is rendered. Use this to inject custom content or functionality within individual log tabs in the admin area. The hook name includes the dynamic tab key, allowing targeted customization.
Usage
add_action( 'automator_admin_logs_top_level_tabs_item_content_{dynamic}', 'your_function_name', 10, 1 );
Examples
/**
* Add custom content to the 'general' tab in the Automator admin logs.
*
* This function hooks into the 'automator_admin_logs_top_level_tabs_item_content_general'
* action hook to display additional information within the general logs tab.
*
* @param string $tab_key The key of the current tab.
*/
add_action( 'automator_admin_logs_top_level_tabs_item_content_general', function( $tab_key ) {
// Example: Display a count of recent log entries for the 'general' tab.
$recent_log_count = intval( get_option( 'automator_general_log_count', 0 ) );
if ( $recent_log_count > 0 ) {
?>
<div class="automator-log-summary">
<h3>General Log Summary</h3>
<p>You have <strong><?php echo esc_html( $recent_log_count ); ?></strong> new entries in the general logs since your last check.</p>
<p><a href="<?php echo esc_url( admin_url( 'admin.php?page=automator-logs&tab=general' ) ); ?>">View General Logs</a></p>
</div>
<?php
} else {
?>
<div class="automator-log-summary">
<p>No recent entries found in the general logs.</p>
</div>
<?php
}
// Note: This hook is an action hook, so no return statement is needed.
}, 10, 1 ); // 10 is the default priority, 1 is the number of accepted arguments.
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/views/admin-logs/admin-logs.php:60
foreach ( $tabs as $tab_key => $setting_tab ) {
if ( $setting_tab->is_selected || $setting_tab->preload ) {
?>
<uo-tab-panel id="<?php echo esc_attr( $tab_key ); ?>" <?php echo $setting_tab->is_selected ? 'active' : ''; ?>>
<?php do_action( 'automator_admin_logs_top_level_tabs_item_content_' . $tab_key ); ?>
</uo-tab-panel>
<?php
}
}