Filter uncanny-automator

automator_admin_tools_status_tabs

Filters the status tabs displayed in the Automator admin tools menu.

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

Description

Filters the array of status tabs displayed in the Automator admin tools. Developers can use this hook to add, remove, or modify the default status tabs, providing custom information or tools within the WordPress admin area. It fires when the status tabs are being generated.


Usage

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

Return Value

The filtered value.


Examples

/**
 * Add a custom status tab to the Automator admin tools.
 *
 * This function demonstrates how to add a new tab to the 'Status' section
 * of the Automator plugin's admin area. It appends a new tab definition
 * to the existing array of tabs.
 *
 * @param array $tabs An array of existing status tabs.
 * @return array The modified array of status tabs, including the new custom tab.
 */
add_filter( 'automator_admin_tools_status_tabs', 'my_custom_automator_status_tab', 10, 1 );
function my_custom_automator_status_tab( $tabs ) {

    // Define our new custom tab.
    // The 'label' is what will be displayed on the tab.
    // The 'slug' is a unique identifier for the tab, used in URLs and internally.
    // The 'callback' is the function that will render the content of this tab.
    $custom_tab = array(
        'label'    => __( 'My Custom Status', 'your-text-domain' ),
        'slug'     => 'my-custom-status',
        'callback' => 'render_my_custom_automator_status_content',
    );

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

    return $tabs;
}

/**
 * Callback function to render the content for the custom status tab.
 *
 * This function would contain the HTML and logic to display the information
 * for the 'My Custom Status' tab. For this example, we'll just show a simple message.
 */
function render_my_custom_automator_status_content() {
    ?>
    <div class="automator-status-tab-content">
        <h2><?php esc_html_e( 'My Custom Status Information', 'your-text-domain' ); ?></h2>
        <p><?php esc_html_e( 'This is the content for my custom Automator status tab. You can display custom plugin statuses, check configurations, or provide helpful links here.', 'your-text-domain' ); ?></p>

        <?php
        // Example: Check a custom setting or perform a quick diagnostic
        $my_custom_setting = get_option( 'my_plugin_custom_setting', 'not set' );
        ?>
        <p>
            <strong><?php esc_html_e( 'My Custom Setting:', 'your-text-domain' ); ?></strong>
            <?php echo esc_html( $my_custom_setting ); ?>
        </p>
    </div>
    <?php
}

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/status.php:104

public function get_status_tabs() {

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

Scroll to Top