Action
Dynamic
uncanny-automator
automator_settings_uncanny_agent_{dynamic}_tab
> **Note:** This is a dynamic hook. The actual hook name is constructed at runtime. Fires when a dynamic tab within the Uncanny Automator settings is being rendered or interacted with.
add_action( 'automator_settings_uncanny_agent_{dynamic}_tab', $callback, 10, 1 );
Description
Fires within a specific Uncanny Agent tab's content area. Developers can use this to inject custom content, settings, or integrations into individual Uncanny Agent tabs. The `{dynamic}` placeholder will be replaced with the actual tab key (e.g., `general`, `api`).
Usage
add_action( 'automator_settings_uncanny_agent_{dynamic}_tab', 'your_function_name', 10, 1 );
Examples
// Example of adding content to the "General" tab of Uncanny Automator settings.
// This hook fires within the Uncanny Automator settings page, specifically for the Uncanny Agent tab.
// The dynamic part of the hook name will be the $tab_key, which in this case would be 'general'.
add_action( 'automator_settings_uncanny_agent_general_tab', 'my_custom_uncanny_agent_general_settings_content', 10 );
/**
* Adds custom content to the general tab of the Uncanny Agent settings page.
*
* @since 1.0.0
*/
function my_custom_uncanny_agent_general_settings_content() {
// Example: Display a notice about a new feature or a reminder.
?>
<div class="uo-notice uo-notice--info uo-notice--dismissible">
<p><?php esc_html_e( 'Just a friendly reminder: You can enable advanced logging for Uncanny Agent under the "Developer" tab for more detailed troubleshooting.', 'your-text-domain' ); ?></p>
</div>
<?php
// Example: Add a new setting field.
// Assuming we have a setting to control a specific Uncanny Agent behavior.
$enable_experimental_feature = get_option( 'my_ua_enable_experimental_feature', 'no' );
?>
<div class="uo-form-group">
<label for="my_ua_enable_experimental_feature" class="uo-label"><?php esc_html_e( 'Enable Experimental Agent Feature', 'your-text-domain' ); ?></label>
<div class="uo-checkbox-wrapper">
<input type="checkbox" id="my_ua_enable_experimental_feature" name="my_ua_enable_experimental_feature" value="yes" <?php checked( $enable_experimental_feature, 'yes' ); ?> />
<label for="my_ua_enable_experimental_feature"><?php esc_html_e( 'If checked, this will enable a new experimental feature for the Uncanny Agent.', 'your-text-domain' ); ?></label>
</div>
</div>
<script type="text/javascript">
jQuery(document).ready(function($) {
// Example: Handle saving the custom setting.
// In a real scenario, this would likely be handled by Uncanny Automator's AJAX or form submission process.
// This is a simplified example for demonstration.
$('#my_ua_enable_experimental_feature').on('change', function() {
var is_checked = $(this).is(':checked') ? 'yes' : 'no';
// In a real plugin, you'd send this to your backend via AJAX or include it in a form submission.
// For this example, we'll just log it.
console.log('Experimental feature setting changed to:', is_checked);
// A more complete implementation would involve saving this option using update_option() via AJAX.
});
});
</script>
<?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/uncanny-agent.php:67
?>
<uo-tab-panel id="<?php echo esc_attr( $tab_key ); ?>"
<?php echo $uncanny_agent_tab->is_selected ? 'active' : ''; ?>
><!--uo-tab-panel />-->
<?php do_action( 'automator_settings_uncanny_agent_' . $tab_key . '_tab' ); ?>
</uo-tab-panel>
<?php
}
}