| 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 |
} |