Filter
uncanny-automator-pro
automator_select_query_run_should_support_custom_value
Filters whether the DB Query integration should support custom value selection in automator queries.
add_filter( 'automator_select_query_run_should_support_custom_value', $callback, 10, 1 );
Description
Filters whether the DB Query action's select field should support custom user input. By default, it's set to false, meaning users must select from predefined options. Developers can return true to allow custom values, providing more dynamic trigger behavior.
Usage
add_filter( 'automator_select_query_run_should_support_custom_value', 'your_function_name', 10, 1 );
Parameters
-
$this(mixed) - This parameter is a boolean value that determines whether the select query run action should support custom value input.
Return Value
The filtered value.
Examples
add_filter( 'automator_select_query_run_should_support_custom_value', 'my_automator_support_custom_db_query_value', 10, 2 );
/**
* Allows users to input a custom value for the 'COLUMN' select field in the DB Query action.
*
* This filter hook determines whether the 'COLUMN' select field in Uncanny Automator's
* 'Select Query Run' action should support custom input values in addition to predefined options.
* By default, it's set to false, meaning only predefined options can be selected.
* This example enables custom input for the 'COLUMN' field.
*
* @param bool $should_support_custom_value The current value of the filter. False by default.
* @param object $automator_action_instance The instance of the Uncanny Automator action object.
*
* @return bool True if custom values should be supported, false otherwise.
*/
function my_automator_support_custom_db_query_value( $should_support_custom_value, $automator_action_instance ) {
// We want to enable custom value input for the 'COLUMN' select field.
return true;
}
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
uncanny-automator-pro/src/integrations/db-query/actions/select-query-run.php:100
/**
* Loads available options for the Trigger.
*
* @return array The available trigger options.
*/
public function options() {
$should_support_custom_value = apply_filters( 'automator_select_query_run_should_support_custom_value', false, $this );
$columns = array(
'input_type' => 'select',
'option_code' => 'COLUMN',
'label' => esc_attr_x( 'Columns', 'DB Query', 'uncanny-automator-pro' ),
'description' => esc_attr_x( "The columns (fields) that will be returned by the query. The data in these columns will populate the action's tokens.", 'DB Query', 'uncanny-automator-pro' ),
'required' => true,