PluginProbe
JetFormBuilder — Dynamic Blocks Form Builder / 1.5.2
JetFormBuilder — Dynamic Blocks Form Builder v1.5.2
3.6.5.2 3.6.5.1 3.6.5 3.6.4.2 3.6.4.1 3.6.4 3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 All 130 releases
jetformbuilder / includes / blocks / render / action-button-render.php
action-button-render.php
55 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Jet_Form_Builder\Blocks\Render;
4
5 // If this file is called directly, abort.
6 use Jet_Form_Builder\Blocks\Button_Types\Button_Type_Base;
7 use Jet_Form_Builder\Blocks\Types\Action_Button;
8 use Jet_Form_Builder\Blocks\Types\Submit_Field;
9 use Jet_Form_Builder\Classes\Attributes_Trait;
10
11 if ( ! defined( 'WPINC' ) ) {
12 die;
13 }
14
15 /**
16 * Define text field renderer class
17 * @property Action_Button $block_type
18 */
19 class Action_Button_Render extends Base {
20
21 public $wrapper;
22
23 public function get_name() {
24 return 'action-button';
25 }
26
27 public function label_allowed() {
28 return false;
29 }
30
31 public function before_render( $args ) {
32 $type = $args['action_type'] ?? '';
33 $this->wrapper = new class() {
34 use Attributes_Trait;
35 };
36
37 /** @var Button_Type_Base $type */
38 $type = $this->block_type->get_button_type( $type );
39
40 $this->add_attribute( 'class', 'jet-form-builder__action-button' );
41 $this->add_attribute( 'class', $args['class_name'] );
42 $this->add_attribute( 'class', $type->get_class( 'button' ) );
43 $this->add_attribute( 'type', $type->get_type() );
44
45 $wrap_classes = array( $type->get_class( 'wrapper' ) );
46
47 if ( isset( $args['add_prev'] ) && $args['add_prev'] && 1 < $this->block_type->get_current_form_break()->get_current() ) {
48 $wrap_classes[] = 'has-prev';
49 }
50
51 $this->wrapper->add_attribute( 'class', $wrap_classes );
52 }
53
54 }
55