Action
Dynamic
uncanny-automator
automator_settings_general_{dynamic}_tab
> **Note:** This is a dynamic hook. The actual hook name is constructed at runtime. Fires after a dynamic general settings tab is loaded, allowing customization of its content.
add_action( 'automator_settings_general_{dynamic}_tab', $callback, 10, 1 );
Description
Fires within the General settings tab interface, dynamically allowing integrations to add content to specific sub-tabs when they are selected. This hook is crucial for customizing the display of settings unique to each general tab.
Usage
add_action( 'automator_settings_general_{dynamic}_tab', 'your_function_name', 10, 1 );
Examples
add_action( 'automator_settings_general_triggers_tab', 'my_custom_automator_triggers_tab_content', 10, 0 );
/**
* Adds custom content to the 'Triggers' tab in the Automator settings.
* This example demonstrates how to add a custom input field for a new trigger setting.
*/
function my_custom_automator_triggers_tab_content() {
// Assume a custom setting key and a way to retrieve its current value.
// In a real scenario, you'd likely use WordPress options or a custom plugin setting.
$my_custom_trigger_setting = get_option( 'my_plugin_custom_trigger_frequency', 'daily' );
?>
<div class="automator-settings-section">
<h3><?php esc_html_e( 'Custom Trigger Settings', 'your-text-domain' ); ?></h3>
<p><?php esc_html_e( 'Configure settings for your custom triggers below.', 'your-text-domain' ); ?></p>
<label for="my_plugin_custom_trigger_frequency">
<?php esc_html_e( 'Custom Trigger Frequency:', 'your-text-domain' ); ?>
</label>
<select name="my_plugin_custom_trigger_frequency" id="my_plugin_custom_trigger_frequency">
<option value="hourly" <?php selected( $my_custom_trigger_setting, 'hourly' ); ?>>
<?php esc_html_e( 'Hourly', 'your-text-domain' ); ?>
</option>
<option value="daily" <?php selected( $my_custom_trigger_setting, 'daily' ); ?>>
<?php esc_html_e( 'Daily', 'your-text-domain' ); ?>
</option>
<option value="weekly" <?php selected( $my_custom_trigger_setting, 'weekly' ); ?>>
<?php esc_html_e( 'Weekly', 'your-text-domain' ); ?>
</option>
</select>
<p class="description">
<?php esc_html_e( 'Choose how often your custom triggers should check for updates.', 'your-text-domain' ); ?>
</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/general.php:113
// IF the tab is selected, then add the "active" attribute
echo $general_tab->is_selected ? 'active' : '';
?>
>
<?php do_action( 'automator_settings_general_' . $tab_key . '_tab' ); ?>
</uo-tab-panel>
<?php
}
}