← All changes
|
app/Services/FormBuilder/Components/SectionBreak.php
+48
-23
3.6.64
→
6.2.14
View file →
| @@ -5,35 +5,60 @@ | ||
| 5 | 5 | use FluentForm\Framework\Helpers\ArrayHelper; |
| 6 | 6 | |
| 7 | 7 | class SectionBreak extends BaseComponent |
| 8 | 8 | { |
| 9 | - /** | |
| 10 | - * Compile and echo the html element | |
| 11 | - * @param array $data [element data] | |
| 12 | - * @param stdClass $form [Form Object] | |
| 13 | - * @return viod | |
| 14 | - */ | |
| 15 | - public function compile($data, $form) | |
| 16 | - { | |
| 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 | + { | |
| 17 | 19 | $elementName = $data['element']; |
| 18 | - $data = apply_filters('fluenform_rendering_field_data_'.$elementName, $data, $form); | |
| 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); | |
| 19 | 31 | |
| 20 | 32 | $alignment = ArrayHelper::get($data, 'settings.align'); |
| 21 | - if($alignment) { | |
| 22 | - $data['attributes']['class'] .= ' ff_'.$alignment; | |
| 33 | + if ($alignment) { | |
| 34 | + $data['attributes']['class'] .= ' ff_' . $alignment; | |
| 23 | 35 | } |
| 24 | 36 | |
| 25 | 37 | $hasConditions = $this->hasConditions($data) ? 'has-conditions ' : ''; |
| 26 | - $cls = trim($this->getDefaultContainerClass().' '.$hasConditions); | |
| 27 | - $data['attributes']['class'] = $cls .' ff-el-section-break '. $data['attributes']['class']; | |
| 28 | - $data['attributes']['class'] = trim($data['attributes']['class']); | |
| 29 | - $atts = $this->buildAttributes( | |
| 30 | - \FluentForm\Framework\Helpers\ArrayHelper::except($data['attributes'], 'name') | |
| 31 | - ); | |
| 32 | - $html = "<div {$atts}>"; | |
| 33 | - $html .= "<h3 class='ff-el-section-title'>{$data['settings']['label']}</h3>"; | |
| 34 | - $html .= "<div class='ff-section_break_desk'>{$data['settings']['description']}</div>"; | |
| 35 | - $html .= "<hr />"; | |
| 36 | - $html .= "</div>"; | |
| 37 | - echo apply_filters('fluenform_rendering_field_html_'.$elementName, $html, $data, $form); | |
| 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); | |
| 38 | 63 | } |
| 39 | 64 | } |