Filter uncanny-automator

automator_admin_tools_debug_tabs

Filters the debug tabs array, allowing customization of the automator admin tools debug interface.

add_filter( 'automator_admin_tools_debug_tabs', $callback, 10, 1 );

Description

Fires to retrieve the debug tabs for the Automator admin tools. Developers can use this filter to add, remove, or modify debug tab definitions, influencing which debugging features are available. It's important to return an array of tab definitions.


Usage

add_filter( 'automator_admin_tools_debug_tabs', 'your_function_name', 10, 1 );

Return Value

The filtered value.


Examples

add_filter( 'automator_admin_tools_debug_tabs', 'my_custom_automator_debug_tabs', 10, 1 );

/**
 * Adds a custom debug tab to the Automator admin tools.
 *
 * This function demonstrates how to add a new tab to the Automator plugin's
 * debug section. It appends a new array item to the existing tabs array.
 *
 * @param array $tabs The existing debug tabs.
 * @return array The modified debug tabs with the new custom tab added.
 */
function my_custom_automator_debug_tabs( $tabs ) {
    // Define the details for our new custom debug tab.
    $custom_tab = array(
        'id'    => 'my_custom_debug_section',
        'title' => __( 'My Custom Debug', 'your-text-domain' ),
        'callback' => array( 'My_Custom_Automator_Debug_Handler', 'render_custom_section' ),
    );

    // Append the custom tab to the existing array of tabs.
    $tabs[] = $custom_tab;

    return $tabs;
}

// Example of a class that might handle the rendering of the custom debug section.
// This would typically reside in its own file and be included or autoloaded.
if ( ! class_exists( 'My_Custom_Automator_Debug_Handler' ) ) {
    class My_Custom_Automator_Debug_Handler {
        /**
         * Renders the content for the custom debug section.
         */
        public static function render_custom_section() {
            echo '<div class="automator-debug-section">';
            echo '<h2>' . __( 'Custom Debug Information', 'your-text-domain' ) . '</h2>';
            echo '<p>' . __( 'This is where you can display custom debug information for your integration.', 'your-text-domain' ) . '</p>';

            // Example: Display a simple piece of custom data
            $custom_data = get_option( 'my_custom_automator_data', 'No custom data found.' );
            echo '<p><strong>' . __( 'Custom Data:', 'your-text-domain' ) . '</strong> ' . esc_html( $custom_data ) . '</p>';

            echo '</div>';
        }
    }
}

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/admin/admin-tools/tabs/debug.php:187

public function get_debug_tabs() {

		return apply_filters( 'automator_admin_tools_debug_tabs', array() );
	}

Scroll to Top