Action
Dynamic
uncanny-automator
automator_settings_addons_{dynamic}_tab
> **Note:** This is a dynamic hook. The actual hook name is constructed at runtime. Fires when the Automator Settings addons tab is loaded, allowing for dynamic tab content and integrations.
add_action( 'automator_settings_addons_{dynamic}_tab', $callback, 10, 1 );
Description
Fires within the Add-ons settings tab for a specific add-on tab. Developers can use this hook to add custom content or functionality directly within a particular add-on's settings section. The `$tab_key` variable determines the exact hook name, allowing for granular control.
Usage
add_action( 'automator_settings_addons_{dynamic}_tab', 'your_function_name', 10, 1 );
Examples
add_action( 'automator_settings_addons_my-custom-addon_tab', 'my_plugin_render_my_custom_addon_settings', 10, 0 );
/**
* Renders the settings for the 'My Custom Addon' tab.
* This function would typically output HTML form fields and other elements
* to configure the specific addon.
*/
function my_plugin_render_my_custom_addon_settings() {
// Assume we have some settings for our custom addon that we want to display.
// In a real plugin, you might retrieve these from the database (e.g., using get_option()).
$my_addon_api_key = get_option( 'my_addon_api_key', '' );
$my_addon_enable_feature = get_option( 'my_addon_enable_feature', 'no' );
?>
<div class="my-addon-settings-section">
<h3><?php esc_html_e( 'My Custom Addon Configuration', 'my-plugin-textdomain' ); ?></h3>
<label for="my-addon-api-key">
<?php esc_html_e( 'API Key:', 'my-plugin-textdomain' ); ?>
</label>
<input type="text" id="my-addon-api-key" name="my_addon_api_key" value="<?php echo esc_attr( $my_addon_api_key ); ?>" class="regular-text">
<p class="description"><?php esc_html_e( 'Enter your API key for the custom addon.', 'my-plugin-textdomain' ); ?></p>
<p>
<label>
<input type="checkbox" name="my_addon_enable_feature" value="yes" <?php checked( $my_addon_enable_feature, 'yes' ); ?>>
<?php esc_html_e( 'Enable Advanced Feature', 'my-plugin-textdomain' ); ?>
</label>
</p>
<p class="description"><?php esc_html_e( 'Check this to enable an advanced feature of the addon.', 'my-plugin-textdomain' ); ?></p>
<p>
<button class="button button-primary" name="save_my_addon_settings">
<?php esc_html_e( 'Save Settings', 'my-plugin-textdomain' ); ?>
</button>
</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/views/admin-settings/tab/addons.php:67
?>
<uo-tab-panel id="<?php echo esc_attr( $tab_key ); ?>"
<?php echo $tab->is_selected ? 'active' : ''; ?>
><!--uo-tab-panel />-->
<?php do_action( 'automator_settings_addons_' . $tab_key . '_tab' ); ?>
</uo-tab-panel>
<?php
}
}