PluginProbe
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.4
JetFormBuilder — Dynamic Blocks Form Builder v3.6.4
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
67 lines 1.5 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\Classes\Attributes_Trait;
9
10 if ( ! defined( 'WPINC' ) ) {
11 die;
12 }
13
14 /**
15 * Define text field renderer class
16 *
17 * @property Action_Button $block_type
18 */
19 class Action_Button_Render extends Base {
20
21 /**
22 * @var Attributes_Trait
23 */
24 public $wrapper;
25
26 public function get_name() {
27 return 'action-button';
28 }
29
30 public function label_allowed() {
31 return false;
32 }
33
34 public function before_render( $args ) {
35 $type = $args['action_type'] ?? '';
36 $this->wrapper = new class() {
37 use Attributes_Trait;
38 };
39
40 /** @var Button_Type_Base $type */
41 $type = $this->block_type->get_button_type( $type );
42
43 if ( is_null( $type ) ) {
44 return;
45 }
46
47 $this->add_attribute( 'class', 'jet-form-builder__action-button' );
48 $this->add_attribute( 'class', $args['class_name'] ?? '' );
49 $this->add_attribute( 'class', $type->get_class( 'button' ) );
50 $this->add_attribute( 'type', $type->get_type() );
51
52 $type->before_render( $this, $args );
53
54 $wrap_classes = array(
55 'jet-form-builder__action-button-wrapper',
56 $type->get_class( 'wrapper' ),
57 );
58
59 if ( isset( $args['add_prev'] ) && $args['add_prev'] && 1 < $this->block_type->get_current_form_break()->get_current() ) {
60 $wrap_classes[] = 'has-prev';
61 }
62 $this->wrapper->add_attribute( 'data-type', $type->slug() );
63 $this->wrapper->add_attribute( 'class', $wrap_classes );
64 }
65
66 }
67