widgetKey = $this->key; $this->widgetTitle = $this->title; } $this->verify = new Verify(); add_action( 'wp_enqueue_scripts', [ AdCaptcha::class, 'enqueue_scripts' ], 9 ); add_action( 'wp_enqueue_scripts', [ Verify::class, 'get_success_token' ] ); add_filter( 'fluentform/response_render_' . $this->widgetKey, [ $this, 'renderResponse' ], 10, 3 ); add_filter( 'fluentform/validate_input_item_' . $this->widgetKey, [ $this, 'verify' ], 10, 5 ); } /** * Get Element Component * * @return array */ public function getComponent() { return [ 'index' => 16, 'element' => $this->widgetKey, 'attributes' => [ 'name' => $this->widgetKey, ], 'settings' => [ 'label' => '', 'validation_rules' => [], ], 'editor_options' => [ 'title' => $this->widgetTitle, 'icon_class' => 'ff-edit-adcaptcha', 'template' => 'inputHidden', ], ]; } /** * Render element * * @param mixed $data Settings. * @param mixed $form Form. * @return void */ public function render( $data, $form ) { $element_name = $data['element']; $settings = $data['settings']; $label = ''; if ( ! empty( $settings['label'] ) ) { $label = "
'; } $container_class = ''; if ( ! empty( $settings['label_placement'] ) ) { $container_class = 'ff-el-form-' . $settings['label_placement']; } $adcaptcha = AdCaptcha::ob_captcha_trigger(); $el = "