PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / trunk
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder vtrunk
6.2.15 6.2.14 6.2.13 6.2.12 6.2.10 6.2.11 6.2.9 6.2.8 6.2.7 6.2.6 6.2.5 6.2.4 6.2.3 6.2.2 3.6.22 3.6.31 3.6.40 3.6.41 3.6.42 3.6.50 3.6.51 3.6.60 3.6.61 3.6.62 3.6.64 All 197 releases
fluentform / app / Services / FormBuilder / Components / SectionBreak.php

SectionBreak.php in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder trunk, at app/Services/FormBuilder/Components/SectionBreak.php

65 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentForm\App\Services\FormBuilder\Components;
4
5 use FluentForm\Framework\Helpers\ArrayHelper;
6
7 class SectionBreak extends BaseComponent
8 {
9 /**
10 * Compile and echo the html element
11 *
12 * @param array $data [element data]
13 * @param \stdClass $form [Form Object]
14 *
15 * @return void
16 */
17 public function compile($data, $form)
18 {
19 $elementName = $data['element'];
20 $data = apply_filters_deprecated(
21 'fluentform_rendering_field_data_' . $elementName,
22 [
23 $data,
24 $form
25 ],
26 FLUENTFORM_FRAMEWORK_UPGRADE,
27 'fluentform/rendering_field_data_' . $elementName,
28 'Use fluentform/rendering_field_data_' . $elementName . ' instead of fluentform_rendering_field_data_' . $elementName
29 );
30 $data = apply_filters('fluentform/rendering_field_data_' . $elementName, $data, $form);
31
32 $alignment = ArrayHelper::get($data, 'settings.align');
33 if ($alignment) {
34 $data['attributes']['class'] .= ' ff_' . $alignment;
35 }
36
37 $hasConditions = $this->hasConditions($data) ? 'has-conditions ' : '';
38 $cls = trim($this->getDefaultContainerClass() . ' ' . $hasConditions);
39 $data['attributes']['class'] = $cls . ' ff-el-section-break ' . $data['attributes']['class'];
40 $data['attributes']['class'] = trim($data['attributes']['class']);
41 $atts = $this->buildAttributes(
42 ArrayHelper::except($data['attributes'], 'name')
43 );
44 $html = "<div {$atts}>"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $atts is escaped before being passed in.
45 $html .= "<h3 class='ff-el-section-title'>" . fluentform_sanitize_html($data['settings']['label']) . '</h3>';
46 $html .= "<div class='ff-section_break_desk'>" . fluentform_sanitize_html($data['settings']['description']) . '</div>';
47 $html .= '<hr />';
48 $html .= '</div>';
49
50 $html = apply_filters_deprecated(
51 'fluentform_rendering_field_html_' . $elementName,
52 [
53 $html,
54 $data,
55 $form
56 ],
57 FLUENTFORM_FRAMEWORK_UPGRADE,
58 'fluentform/rendering_field_html_' . $elementName,
59 'Use fluentform/rendering_field_html_' . $elementName . ' instead of fluentform_rendering_field_html_' . $elementName
60 );
61
62 $this->printContent('fluentform/rendering_field_html_' . $elementName, $html, $data, $form);
63 }
64 }
65