| @@ -1,97 +1,91 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -/** | |
| 4 | - * Text Field Class | |
| 5 | - */ | |
| 6 | -class WeForms_Form_Field_SectionBreak extends WeForms_Field_Contract { | |
| 7 | - | |
| 8 | - public function __construct() { | |
| 9 | - $this->name = __( 'Section Break', 'weforms' ); | |
| 10 | - $this->input_type = 'section_break'; | |
| 11 | - $this->icon = 'columns'; | |
| 12 | - } | |
| 13 | - | |
| 14 | - /** | |
| 15 | - * Render the text field | |
| 16 | - * | |
| 17 | - * @param array $field_settings | |
| 18 | - * @param int $form_id | |
| 19 | - * | |
| 20 | - * @return void | |
| 21 | - */ | |
| 22 | - public function render( $field_settings, $form_id ) { | |
| 23 | - $description = isset( $field_settings['description'] ) ? $field_settings['description'] : ''; | |
| 24 | - $name = isset( $field_settings['name'] ) ? $field_settings['name'] : ''; ?> | |
| 25 | - <li <?php $this->print_list_attributes( $field_settings ); ?>> | |
| 26 | - <div class="wpuf-section-wrap wpuf-fields <?php echo 'section_' . esc_attr( $form_id ); ?><?php echo ' wpuf_' . esc_html( $name ) . '_' . esc_attr( $form_id ); ?>"> | |
| 27 | - <h2 class="wpuf-section-title"><?php echo esc_attr( $field_settings['label'] ); ?></h2> | |
| 28 | - <div class="wpuf-section-details"><?php echo esc_attr( $description ); ?></div> | |
| 29 | - </div> | |
| 30 | - | |
| 31 | - </li> | |
| 32 | - <?php | |
| 33 | - } | |
| 34 | - | |
| 35 | - /** | |
| 36 | - * It's a full width block | |
| 37 | - * | |
| 38 | - * @return bool | |
| 39 | - */ | |
| 40 | - public function is_full_width() { | |
| 41 | - return true; | |
| 42 | - } | |
| 43 | - | |
| 44 | - /** | |
| 45 | - * Get field options setting | |
| 46 | - * | |
| 47 | - * @return array | |
| 48 | - */ | |
| 49 | - public function get_options_settings() { | |
| 50 | - $options = [ | |
| 51 | - [ | |
| 52 | - 'name' => 'label', | |
| 53 | - 'title' => __( 'Title', 'weforms' ), | |
| 54 | - 'type' => 'text', | |
| 55 | - 'section' => 'basic', | |
| 56 | - 'priority' => 10, | |
| 57 | - 'help_text' => __( 'Title of the section', 'weforms' ), | |
| 58 | - ], | |
| 59 | - [ | |
| 60 | - 'name' => 'name', | |
| 61 | - 'title' => __( 'Meta Key', 'weforms' ), | |
| 62 | - 'type' => 'text-meta', | |
| 63 | - 'section' => 'basic', | |
| 64 | - 'priority' => 11, | |
| 65 | - 'help_text' => __( 'Name of the meta key this field will save to', 'weforms' ), | |
| 66 | - ], | |
| 67 | - [ | |
| 68 | - 'name' => 'description', | |
| 69 | - 'title' => __( 'Description', 'weforms' ), | |
| 70 | - 'type' => 'textarea', | |
| 71 | - 'section' => 'basic', | |
| 72 | - 'priority' => 12, | |
| 73 | - 'help_text' => __( 'Some details text about the section', 'weforms' ), | |
| 74 | - ], | |
| 75 | - ]; | |
| 76 | - | |
| 77 | - return $options; | |
| 78 | - } | |
| 79 | - | |
| 80 | - /** | |
| 81 | - * Get the field props | |
| 82 | - * | |
| 83 | - * @return array | |
| 84 | - */ | |
| 85 | - public function get_field_props() { | |
| 86 | - $props = [ | |
| 87 | - 'template' => $this->get_type(), | |
| 88 | - 'label' => $this->get_name(), | |
| 89 | - 'description' => __( 'Some description about this section', 'weforms' ), | |
| 90 | - 'id' => 0, | |
| 91 | - 'is_new' => true, | |
| 92 | - 'wpuf_cond' => $this->default_conditional_prop(), | |
| 93 | - ]; | |
| 94 | - | |
| 95 | - return $props; | |
| 96 | - } | |
| 97 | -} | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Text Field Class | |
| 5 | + */ | |
| 6 | +class WeForms_Form_Field_SectionBreak extends WeForms_Field_Contract { | |
| 7 | + | |
| 8 | + function __construct() { | |
| 9 | + $this->name = __( 'Section Break', 'weforms' ); | |
| 10 | + $this->input_type = 'section_break'; | |
| 11 | + $this->icon = 'columns'; | |
| 12 | + } | |
| 13 | + | |
| 14 | + /** | |
| 15 | + * Render the text field | |
| 16 | + * | |
| 17 | + * @param array $field_settings | |
| 18 | + * @param integer $form_id | |
| 19 | + * | |
| 20 | + * @return void | |
| 21 | + */ | |
| 22 | + public function render( $field_settings, $form_id ) { | |
| 23 | + | |
| 24 | + $field_settings['description'] = isset( $field_settings['description'] ) ? $field_settings['description'] : ''; | |
| 25 | + ?> | |
| 26 | + <li <?php $this->print_list_attributes( $field_settings ); ?>> | |
| 27 | + <div class="wpuf-section-wrap <?php echo 'section_' . $form_id; ?>"> | |
| 28 | + <h2 class="wpuf-section-title"><?php echo $field_settings['label']; ?></h2> | |
| 29 | + <div class="wpuf-section-details"><?php echo $field_settings['description']; ?></div> | |
| 30 | + </div> | |
| 31 | + | |
| 32 | + </li> | |
| 33 | + <?php | |
| 34 | + } | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * It's a full width block | |
| 38 | + * | |
| 39 | + * @return boolean | |
| 40 | + */ | |
| 41 | + public function is_full_width() { | |
| 42 | + return true; | |
| 43 | + } | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * Get field options setting | |
| 47 | + * | |
| 48 | + * @return array | |
| 49 | + */ | |
| 50 | + public function get_options_settings() { | |
| 51 | + $options = array( | |
| 52 | + array( | |
| 53 | + 'name' => 'label', | |
| 54 | + 'title' => __( 'Title', 'wpuf' ), | |
| 55 | + 'type' => 'text', | |
| 56 | + 'section' => 'basic', | |
| 57 | + 'priority' => 10, | |
| 58 | + 'help_text' => __( 'Title of the section', 'wpuf' ), | |
| 59 | + ), | |
| 60 | + | |
| 61 | + array( | |
| 62 | + 'name' => 'description', | |
| 63 | + 'title' => __( 'Description', 'wpuf' ), | |
| 64 | + 'type' => 'textarea', | |
| 65 | + 'section' => 'basic', | |
| 66 | + 'priority' => 11, | |
| 67 | + 'help_text' => __( 'Some details text about the section', 'wpuf' ), | |
| 68 | + ), | |
| 69 | + ); | |
| 70 | + | |
| 71 | + return $options; | |
| 72 | + } | |
| 73 | + | |
| 74 | + /** | |
| 75 | + * Get the field props | |
| 76 | + * | |
| 77 | + * @return array | |
| 78 | + */ | |
| 79 | + public function get_field_props() { | |
| 80 | + $props = array( | |
| 81 | + 'template' => $this->get_type(), | |
| 82 | + 'label' => $this->get_name(), | |
| 83 | + 'description' => __( 'Some description about this section', 'wpuf' ), | |
| 84 | + 'id' => 0, | |
| 85 | + 'is_new' => true, | |
| 86 | + 'wpuf_cond' => null | |
| 87 | + ); | |
| 88 | + | |
| 89 | + return $props; | |
| 90 | + } | |
| 91 | +} | |