Wpwh_Helpers::list_webhook_triggers( null $label = null, string $option_code = 'WPWHTRIGGER', array $args = array() )
Contents
Parameters Parameters
- $label
-
(Optional)
Default value: null
- $option_code
-
(Optional)
Default value: 'WPWHTRIGGER'
- $args
-
(Optional)
Default value: array()
Return Return
(mixed|void)
Source Source
File: src/integrations/wp-webhooks/helpers/wpwh-helpers.php
public function list_webhook_triggers( $label = null, $option_code = 'WPWHTRIGGER', $args = array() ) { if ( ! $label ) { $label = __( 'Webhook triggers', 'uncanny-automator' ); } $token = key_exists( 'token', $args ) ? $args['token'] : false; $is_ajax = key_exists( 'is_ajax', $args ) ? $args['is_ajax'] : false; $target_field = key_exists( 'target_field', $args ) ? $args['target_field'] : ''; $end_point = key_exists( 'endpoint', $args ) ? $args['endpoint'] : ''; $options = array(); $options['-1'] = __( 'Any trigger', 'uncanny-automator-pro' ); $triggers = WPWHPRO()->webhook->get_triggers(); $active_webhooks = WPWHPRO()->settings->get_active_webhooks( 'all' ); foreach ( $triggers as $trigger ) { if ( isset( $active_webhooks['triggers'][ $trigger['trigger'] ] ) ) { $options[ $trigger['trigger'] ] = $trigger['name']; } } $option = [ 'option_code' => $option_code, 'label' => $label, 'input_type' => 'select', 'required' => true, 'supports_tokens' => $token, 'is_ajax' => $is_ajax, 'fill_values_in' => $target_field, 'endpoint' => $end_point, 'options' => $options, 'relevant_tokens' => array(), ]; return apply_filters( 'uap_option_list_webhook_triggers', $option ); }
Expand full source code Collapse full source code View on Github