advanced-rules
3 years ago
button-types
3 years ago
conditional-block
3 years ago
exceptions
3 years ago
modules
3 years ago
render
3 years ago
ssr-validation
3 years ago
types
3 years ago
validation-messages
3 years ago
action-buttons-manager.php
3 years ago
block-helper.php
3 years ago
blocks-repository-base.php
3 years ago
default-blocks-repository.php
3 years ago
dynamic-value.php
3 years ago
form-builder-blocks-repository.php
3 years ago
manager.php
3 years ago
switch-page-on-change.php
3 years ago
validation.php
3 years ago
switch-page-on-change.php
25 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | namespace Jet_Form_Builder\Blocks; |
| 5 | |
| 6 | |
| 7 | use Jet_Form_Builder\Blocks\Types\Base; |
| 8 | |
| 9 | class Switch_Page_On_Change { |
| 10 | |
| 11 | public function __construct() { |
| 12 | add_action( |
| 13 | 'jet-form-builder/before-start-form-row', |
| 14 | array( $this, 'add_switch_page_attr' ) |
| 15 | ); |
| 16 | } |
| 17 | |
| 18 | public function add_switch_page_attr( Base $block ) { |
| 19 | if ( ! array_key_exists( 'switch_on_change', $block->attrs ) ) { |
| 20 | return; |
| 21 | } |
| 22 | $block->add_attribute( 'data-switch-page', (string) $block->block_attrs['switch_on_change'] ); |
| 23 | } |
| 24 | |
| 25 | } |