Action uncanny-automator

automator_app_settings_{$id}_before_{$status}_panel_bottom_right

Fires after the main panel content and before the bottom right panel section for a specific app setting status.

add_action( 'automator_app_settings_{$id}_before_{$status}_panel_bottom_right', $callback, 10, 1 );

Description

Fires before the bottom right panel content for a specific integration's settings, based on the integration's ID and connection status. Developers can hook into this to inject custom content or modify existing elements in that specific panel area for advanced customization.


Usage

add_action( 'automator_app_settings_{$id}_before_{$status}_panel_bottom_right', 'your_function_name', 10, 1 );

Parameters

$this (mixed)
This parameter contains the integration object itself, providing access to its methods and properties.

Examples

/**
 * Example function to hook into automator_app_settings_{$id}_before_{$status}_panel_bottom_right.
 *
 * This function demonstrates how to add custom content or logic
 * before the standard bottom right panel content is displayed in the Automator plugin settings.
 * The `$this` parameter refers to an instance of the integration class.
 *
 * @param object $integration_instance The instance of the integration object.
 */
function my_custom_automator_settings_panel_content( $integration_instance ) {
	// Assuming $integration_instance has methods to get specific data or options.
	$integration_id = $integration_instance->get_id();
	$current_user_id = get_current_user_id();

	// Check if the current user has a specific role that warrants extra information.
	if ( user_can( $current_user_id, 'manage_options' ) ) {
		echo '<div class="automator-custom-notice">';
		echo '<h3>Administrator Note for ' . esc_html( $integration_id ) . ':</h3>';
		echo '<p>This integration is currently active. Ensure all API keys and webhook URLs are up to date for optimal performance.</p>';
		echo '<p>Last checked by admin: ' . date( 'Y-m-d H:i:s' ) . '</p>';
		echo '</div>';
	}

	// You could also add a button or a link to a related management page.
	$manage_url = admin_url( 'admin.php?page=my-custom-integration-settings&integration_id=' . $integration_id );
	echo '<a href="' . esc_url( $manage_url ) . '" class="button button-secondary">Manage Custom Settings</a>';
}

// Add the action hook.
// The second parameter is the number of arguments your function accepts (in this case, 1 for $this).
add_action( 'automator_app_settings_my_plugin_before_connected_panel_bottom_right', 'my_custom_automator_settings_panel_content', 10, 1 );
add_action( 'automator_app_settings_my_plugin_before_disconnected_panel_bottom_right', 'my_custom_automator_settings_panel_content', 10, 1 );

// Example for another integration ID and status
add_action( 'automator_app_settings_another_integration_before_active_panel_bottom_right', 'my_custom_automator_settings_panel_content', 10, 1 );

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:231

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 );
	}


Scroll to Top