Action uncanny-automator

automator_app_settings_{$id}_before_{$status}_panel_bottom_left

Fires before the bottom left section of a specific app's settings panel, allowing for custom actions.

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

Description

Fires before the bottom left content of the settings panel for a specific integration and connection status. Developers can use this hook to inject custom content or modify the existing layout in that area. The `$this` parameter provides access to the integration object.


Usage

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

Parameters

$this (mixed)
This parameter contains the plugin instance responsible for rendering the settings panel.

Examples

/**
 * Example function to add custom content before the bottom left panel in Automator app settings.
 *
 * This function will be triggered by the 'automator_app_settings_{$id}_before_{$status}_panel_bottom_left' hook.
 * It demonstrates how to conditionally display additional information or controls based on the integration ID and its connection status.
 *
 * @param object $automator_app_instance The instance of the Automator app object.
 */
add_action( 'automator_app_settings_some_integration_id_before_connected_panel_bottom_left', function( $automator_app_instance ) {
	// Assuming $automator_app_instance has a method to get specific settings or data.
	// For demonstration, let's imagine we want to show a custom message if a certain option is enabled.
	$custom_option_enabled = $automator_app_instance->get_setting( 'enable_custom_debug_info' );

	if ( $custom_option_enabled ) {
		echo '<div class="notice notice-info inline">';
		echo '<p><strong>Custom Debug Information:</strong> ';
		echo esc_html__( 'Logging is enabled for this integration. Check your server logs for details.', 'your-text-domain' );
		echo '</p>';
		echo '</div>';
	}

	// You could also output a button or a link to a dedicated settings page for this section.
	$reset_api_key_url = admin_url( 'admin.php?page=automator-settings&tab=integrations&action=reset_api_key&integration_id=' . $automator_app_instance->get_id() );
	echo '<p><a href="' . esc_url( $reset_api_key_url ) . '" class="button button-secondary">' . esc_html__( 'Reset API Key', 'your-text-domain' ) . '</a></p>';

}, 10, 1 ); // Priority 10, accepts 1 argument.

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

public function output_panel_bottom_left() {
		// Dynamic hook status key.
		$status = $this->get_hook_status_key();
		$id     = $this->get_id();

		// Hook before bottom left content based on integration and connection status.
		do_action( "automator_app_settings_{$id}_before_{$status}_panel_bottom_left", $this );

		// Output bottom left content based on connection status
		if ( $this->is_connected ) {
			$this->output_bottom_left_connected_content();
		} else {
			$this->output_bottom_left_disconnected_content();
		}

		// Hook after bottom left content based on integration and connection status.
		do_action( "automator_app_settings_{$id}_after_{$status}_panel_bottom_left", $this );
	}


Scroll to Top