Skip to content

Instantly share code, notes, and snippets.

@mantismamita
Last active August 29, 2015 14:04
Show Gist options
  • Save mantismamita/6ef7d1d04fbad4641f35 to your computer and use it in GitHub Desktop.
Save mantismamita/6ef7d1d04fbad4641f35 to your computer and use it in GitHub Desktop.
<?php
/*
* This function outputs HTML for the backend editor.
* The naming convention is: ninja_forms_field_4[custom_value].
* It will be available as $data[custom_value].
*
* $field_id is the id of the field currently being edited.
* $data is an array of the field data, including any custom variables.
*
*/
function budget_field_edit( $field_id, $data ){
if( isset( $data['budget_value'] ) ){
$budget_value = $data['budget_value'];
}else{
$budget_value = '';
}
?>
<input type="text" name="ninja_forms_field_<?php echo $field_id;?>[budget_value]" value="<?php echo $budget_value;?>">
<?php
}
/*
* This function only has to output the specific field element. The wrap is output automatically.
*
* $field_id is the id of the field currently being displayed.
* $data is an array the possibly modified field data for the current field.
*
*/
function budget_field_display( $field_id, $data ){
if( isset( $data['budget_value'] ) ){
$budget_value = $data['budget_value'];
}else{
$budget_value = '';
}
?>
<div class="range_wrapper">
<label id="rangelabel" for="budget">500 &euro;</label>
<input type="range" name="_budget" id="budget" min="500" max="10000" value="500" step="50" onchange="rangevalue.value=value + ' €'">
<label for="budget">10 000 &euro;</label>
</div>
<label for="ninja_forms_field_<?php echo $field_id;?>"><?php _e('Minimum Budget', 'kirsten' ); ?></label>
<input type="text" name="ninja_forms_field_<?php echo $field_id;?>" value="<?php echo $budget_value;?>" id="rangevalue">
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment