Skip to content

Commit

Permalink
Support dt textarea fields (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
kodinkat authored Apr 23, 2024
1 parent dad558c commit 1b1719d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions includes/create-contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ public function create_contact_record( $params ) {
// DT Fields
case 'date':
case 'text':
case 'textarea':
case 'key_select':
$fields[$field['dt_field']] = $lead_value;

Expand Down
3 changes: 2 additions & 1 deletion includes/post-type-active-forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ public function load_extra_fields_meta_box( $post ) {
case 'communication_channel':
case 'text':
case 'boolean':
case 'textarea':
$this->template_row_dt_field_single( $unique_key, $data );
break;
case 'location':
Expand Down Expand Up @@ -505,7 +506,7 @@ function add_dt_fields( id ) {
vInput.append(`<input name="field_${unique_key}[values][]" value="${i}" />`)
})
}
if ( 'text' === v.type || 'communication_channel' === v.type || 'date' === v.type || 'boolean' === v.type ) {
if ( 'text' === v.type || 'textarea' === v.type || 'communication_channel' === v.type || 'date' === v.type || 'boolean' === v.type ) {
labels.append(`<input name="field_${unique_key}[labels]" id="new-labels-${unique_key}" value="${v.name}" />`)
}
}
Expand Down
20 changes: 19 additions & 1 deletion includes/utilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ public static function get_theme( string $theme = 'wide-heavy', string $token =
}
.input-textarea {
height:80px;
width: 100%;
padding: .2em;
font-size: .8em;
border: .5px solid #ccc;
Expand Down Expand Up @@ -303,6 +304,7 @@ public static function get_theme( string $theme = 'wide-heavy', string $token =
}
.input-textarea {
height:80px;
width: 100%;
padding: .5em;
font-size: 1.2em;
border: .5px solid #ccc;
Expand Down Expand Up @@ -562,8 +564,9 @@ public static function get_theme( string $theme = 'wide-heavy', string $token =
}
.input-textarea {
height:80px;
width: 100%;
padding: .5em;
font-size: 1.5em;
font-size: 1em;
font-family: Arial;
border: .5px solid #ccc;
}
Expand Down Expand Up @@ -723,6 +726,7 @@ public static function get_theme( string $theme = 'wide-heavy', string $token =
}
.input-textarea {
height:80px;
width: 100%;
padding: .5em;
font-size: 1.2em;
border: .5px solid #ccc;
Expand Down Expand Up @@ -1225,6 +1229,20 @@ class="input-<?php echo esc_attr( $dt_webform_value['type'] ) ?>"
</div>
<?php
break;
case 'textarea':
?>
<div id="section-<?php echo esc_attr( $dt_webform_value['key'] ) ?>"
class="section section-<?php echo esc_attr( $dt_webform_value['type'] ) ?> section-<?php echo esc_attr( $dt_webform_value['key'] ) ?>">
<label for="<?php echo esc_attr( $dt_webform_value['key'] ) ?>"
class="input-label label-<?php echo esc_attr( $dt_webform_value['type'] ) ?> label-<?php echo esc_attr( $dt_webform_value['key'] ) ?>"><?php echo esc_attr( $dt_webform_value['labels'] ?? '' ) ?></label>
<textarea type="<?php echo esc_attr( $dt_webform_value['type'] ) ?>"
id="<?php echo esc_attr( $dt_webform_value['key'] ) ?>"
name="<?php echo esc_attr( $dt_webform_value['key'] ) ?>"
class="input-<?php echo esc_attr( $dt_webform_value['type'] ) ?>"
<?php echo esc_attr( $dt_webform_value['required'] == 'yes' ? 'required' : '' ) ?>></textarea>
</div>
<?php
break;
case 'location':

if ( is_this_dt() && ! class_exists( 'DT_Mapbox_API' ) ) {
Expand Down

0 comments on commit 1b1719d

Please sign in to comment.