Action
uncanny-automator
automator_app_settings_{$id}_after_{$status}_panel_bottom_right
Fires after the settings panel for a specific app's status displays, allowing custom content insertion.
add_action( 'automator_app_settings_{$id}_after_{$status}_panel_bottom_right', $callback, 10, 1 );
Description
Fires after the bottom-right content of an app settings panel is displayed, conditionally based on integration ID and connection status. Developers can use this hook to add custom elements or logic to this specific area of the settings panel. The connected status dictates which content is shown before this hook fires.
Usage
add_action( 'automator_app_settings_{$id}_after_{$status}_panel_bottom_right', 'your_function_name', 10, 1 );
Parameters
-
$this(mixed) - This parameter contains the instance of the class that is outputting the settings panel.
Examples
<?php
/**
* Example of using the 'automator_app_settings_{$id}_after_{$status}_panel_bottom_right' hook.
*
* This example demonstrates how to add custom content after the default bottom-right panel
* content for a specific Automator app setting, based on its ID and status.
*
* In this scenario, we'll assume we're working with an app integration that has an 'api_key'
* and we want to display a hint to the user if the API key is missing.
*/
add_action(
'automator_app_settings_my_custom_integration_after_connected_panel_bottom_right', // Example hook: replace 'my_custom_integration' with your integration ID and 'connected' with the status.
function ( $app_settings_instance ) {
// Check if the provided instance has the expected method to get API key status.
if ( method_exists( $app_settings_instance, 'get_api_key_status' ) ) {
$api_key_status = $app_settings_instance->get_api_key_status();
// If the API key is not set, display a helpful message.
if ( ! $api_key_status['is_set'] ) {
echo '<div class="automator-hint">';
echo '<strong>API Key Missing:</strong> Please ensure your API key is correctly configured in the settings to enable full functionality.';
echo '</div>';
}
}
},
10, // Priority: 10 is the default, adjust as needed.
1 // Accepted args: The hook passes one argument, $this (the instance of the settings class).
);
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/lib/settings/trait-premium-integration-templating.php:241
public function output_panel_bottom_right() {
// Dynamic hook status key.
$status = $this->get_hook_status_key();
$id = $this->get_id();
// Hook before bottom right content based on integration and connection status.
do_action( "automator_app_settings_{$id}_before_{$status}_panel_bottom_right", $this );
// Output bottom right content based on connection status
if ( $this->is_connected ) {
$this->output_bottom_right_connected_content();
} else {
$this->output_bottom_right_disconnected_content();
}
// Hook after bottom right content based on integration and connection status.
do_action( "automator_app_settings_{$id}_after_{$status}_panel_bottom_right", $this );
}