| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
die( 'You are not allowed to call this page directly.' ); |
| 4 |
} |
| 5 |
|
| 6 |
/** |
| 7 |
* @since 3.0 |
| 8 |
*/ |
| 9 |
class FrmFieldHTML extends FrmFieldType { |
| 10 |
|
| 11 |
/** |
| 12 |
* @var string |
| 13 |
* @since 3.0 |
| 14 |
*/ |
| 15 |
protected $type = 'html'; |
| 16 |
|
| 17 |
/** |
| 18 |
* @var bool |
| 19 |
* @since 3.0 |
| 20 |
*/ |
| 21 |
protected $has_input = false; |
| 22 |
|
| 23 |
/** |
| 24 |
* @since 4.0 |
| 25 |
* |
| 26 |
* @param array $args Includes 'field', 'display', and 'values'. |
| 27 |
* |
| 28 |
* @return void |
| 29 |
*/ |
| 30 |
public function show_primary_options( $args ) { |
| 31 |
$field = $args['field']; |
| 32 |
include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/html-content.php'; |
| 33 |
|
| 34 |
parent::show_primary_options( $args ); |
| 35 |
} |
| 36 |
|
| 37 |
/** |
| 38 |
* @return string |
| 39 |
*/ |
| 40 |
public function default_html() { |
| 41 |
return '<div id="frm_field_[id]_container" class="frm_form_field form-field">[description]</div>'; |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* @since 3.0 |
| 46 |
*/ |
| 47 |
protected function after_replace_html_shortcodes( $args, $html ) { |
| 48 |
FrmFieldsHelper::run_wpautop( array( 'wpautop' => true ), $html ); |
| 49 |
$pre_filter = $html; |
| 50 |
$html = apply_filters( 'frm_get_default_value', $html, (object) $this->field, false ); |
| 51 |
if ( $pre_filter === $html ) { |
| 52 |
$html = do_shortcode( $html ); |
| 53 |
} |
| 54 |
|
| 55 |
return $html; |
| 56 |
} |
| 57 |
|
| 58 |
/** |
| 59 |
* @return string |
| 60 |
*/ |
| 61 |
public function get_container_class() { |
| 62 |
return ' frm_html_container'; |
| 63 |
} |
| 64 |
|
| 65 |
/** |
| 66 |
* @return string |
| 67 |
*/ |
| 68 |
protected function include_form_builder_file() { |
| 69 |
return FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/field-html.php'; |
| 70 |
} |
| 71 |
|
| 72 |
/** |
| 73 |
* Overwrite FrmFieldType::should_strip_most_html_before_preparing_display_value. |
| 74 |
* An HTML field is not populated from user input. |
| 75 |
* It does not need to be passed through FrmAppHelper::strip_most_html. |
| 76 |
* |
| 77 |
* @since 6.8.3 |
| 78 |
* |
| 79 |
* @param array $atts |
| 80 |
* @return bool |
| 81 |
*/ |
| 82 |
protected function should_strip_most_html_before_preparing_display_value( $atts ) { |
| 83 |
return false; |
| 84 |
} |
| 85 |
} |
| 86 |
|