Action uncanny-automator

automator_app_settings_{$id}_after_{$status}_panel

Hook after panel output. Fires after the settings panel for a specific app and status is rendered.

add_action( 'automator_app_settings_{$id}_after_{$status}_panel', $callback, 10, 1 );

Description

Fires after the settings panel for a specific app integration has been rendered. Developers can use this hook to append custom content or perform actions immediately after the default panel elements for a given app ID and status. The `$this` parameter provides access to the integration settings object.


Usage

add_action( 'automator_app_settings_{$id}_after_{$status}_panel', 'your_function_name', 10, 1 );

Parameters

$this (App_Integration_Settings)
The integration settings instance.

Examples

<?php

/**
 * Example of using the automator_app_settings_{$id}_after_{$status}_panel hook.
 *
 * This function appends a custom note to the settings panel for a specific app integration
 * and status, providing additional context or instructions to the user.
 *
 * Replace 'your_app_id' with the actual ID of the app integration and
 * 'your_status' with the specific status you want to target.
 */
add_action( 'automator_app_settings_your_app_id_after_your_status_panel', function( App_Integration_Settings $integration_settings ) {

	// Check if the current status matches the one we're interested in.
	// This is a good practice to ensure the hook only runs when intended.
	// In a real scenario, you might get the status from a property of $integration_settings
	// or another available variable in the scope where the hook is fired.
	// For this example, we assume $integration_settings->get_current_status() exists.
	$current_status = $integration_settings->get_current_status(); // Assuming this method exists

	if ( $current_status === 'your_status' ) {
		echo '<div class="automator-custom-note" style="background-color: #e8f0fe; border-left: 4px solid #4285f4; padding: 10px; margin-top: 15px;">';
		echo '<strong>Important Note:</strong> This section allows you to configure advanced settings for the 'Your App Name' integration. Please ensure you have read the <a href="/docs/your-app-docs" target="_blank">official documentation</a> before making changes.';
		echo '</div>';
	}

}, 10, 1 ); // 10 is the priority, 1 is the number of accepted arguments.

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

public function output_panel() {

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

		/**
		 * Hook before panel output.
		 *
		 * @param App_Integration_Settings $this The integration settings instance.
		 */
		do_action( "automator_app_settings_{$id}_before_{$status}_panel", $this );

		?>
		<div class="uap-settings-panel">
			<div class="uap-settings-panel-top">
				<?php $this->output_panel_top(); ?>
				<?php $this->display_alerts(); ?>
				<div class="uap-settings-panel-content">
					<?php $this->output_panel_content(); ?>
				</div>
			</div>
			<div class="uap-settings-panel-bottom"<?php echo $this->should_show_connect_arrow() ? ' has-arrow' : ''; ?>>
				<?php $this->output_panel_bottom(); ?>
			</div>
		</div>
		<?php
		/**
		 * Hook after panel output.
		 *
		 * @param App_Integration_Settings $this The integration settings instance.
		 */
		do_action( "automator_app_settings_{$id}_after_{$status}_panel", $this );
	}


Scroll to Top