| @@ -1,28 +1,54 @@ | ||
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Row-layout field template | |
| 4 | - */ | |
| 5 | - | |
| 6 | -$fullwidth = ' content-fullwidth'; | |
| 7 | - | |
| 8 | -?> | |
| 9 | -<?php if ( $label || $desc ) : ?> | |
| 10 | -<div class="jet-form-builder-col__start"><?php | |
| 11 | - | |
| 12 | - echo $label; | |
| 13 | - echo $desc; | |
| 14 | - | |
| 15 | - // Reset fullwidth content if we have label or description for field | |
| 16 | - $fullwidth = ''; | |
| 17 | - | |
| 18 | -?></div> | |
| 19 | -<?php endif; ?> | |
| 20 | -<div class="jet-form-builder-col__end<?php echo $fullwidth; ?>"><?php | |
| 21 | - if ( $template ) { | |
| 22 | - if ( is_readable( $template ) ) { | |
| 23 | - include $template; | |
| 24 | - } else { | |
| 25 | - echo $template; | |
| 26 | - } | |
| 27 | - } | |
| 28 | -?></div> | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Row-layout field template | |
| 4 | + * | |
| 5 | + * @var $template | |
| 6 | + * @var $label | |
| 7 | + * @var $desc | |
| 8 | + * @var Base $this | |
| 9 | + */ | |
| 10 | + | |
| 11 | +use Jet_Form_Builder\Blocks\Render\Base; | |
| 12 | +use Jet_Form_Builder\Classes\Tools; | |
| 13 | + | |
| 14 | +// If this file is called directly, abort. | |
| 15 | +if ( ! defined( 'WPINC' ) ) { | |
| 16 | + die; | |
| 17 | +} | |
| 18 | + | |
| 19 | +$fullwidth = ' content-fullwidth'; | |
| 20 | + | |
| 21 | +//phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 22 | + | |
| 23 | +/* | |
| 24 | + * We return the prepared field template. | |
| 25 | + * Each of the listed variables is validated in separate files. | |
| 26 | + * | |
| 27 | + * $label - './field-label.php' | |
| 28 | + * $desc - './field-description.php' | |
| 29 | + * $template - '../fields/{$field_type}.php' ( takes place at the level of a separate field template ) | |
| 30 | + */ | |
| 31 | + | |
| 32 | +?> | |
| 33 | +<?php if ( $this->get_field_label() || $this->get_field_desc() ) : ?> | |
| 34 | + <div class="jet-form-builder-col__start"> | |
| 35 | + <?php | |
| 36 | + // Read the comment above. | |
| 37 | + echo Tools::esc_template_string( $label ); | |
| 38 | + echo Tools::esc_template_string( $desc ); | |
| 39 | + | |
| 40 | + // Reset fullwidth content if we have label or description for field. | |
| 41 | + $fullwidth = ''; | |
| 42 | + | |
| 43 | + ?> | |
| 44 | + </div> | |
| 45 | +<?php endif; ?> | |
| 46 | +<div class="jet-form-builder-col__end<?php echo esc_attr( $fullwidth ); ?>"> | |
| 47 | + <?php | |
| 48 | + // Read the comment above. | |
| 49 | + echo Tools::esc_template_string( $template, false ); | |
| 50 | + | |
| 51 | + //phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 52 | + ?> | |
| 53 | +</div> | |
| 54 | +<?php | |