Commit 43fb5bc0 authored by Eric Windham's avatar Eric Windham

made changes to do the deed

parent 536c407a
......@@ -69,7 +69,32 @@ final class NF_Actions_Save extends NF_Abstracts_Action
$field[ 'value' ] = apply_filters( 'nf_save_sub_user_value', $field[ 'value' ], $field[ 'id' ] );
$sub->update_field_value( $field[ 'id' ], $field[ 'value' ] );
$save_all_none = $action_settings[ 'fields_save_toggle' ];
$save_field = true;
if( 'save_all' == $save_all_none ) {
$save_field = true;
foreach( $action_settings[ 'exception_fields' ] as
$exception_field ) {
if( $field[ 'key' ] == $exception_field[ 'field'] ) {
$save_field = false;
break;
}
}
} else if( 'save_none' == $save_all_none ) {
$save_field = false;
foreach( $action_settings[ 'exception_fields' ] as
$exception_field ) {
if( $field[ 'key' ] == $exception_field[ 'field'] ) {
$save_field = true;
break;
}
}
}
if( $save_field ) {
$sub->update_field_value( $field['id'], $field['value'] );
}
}
if( isset( $data[ 'extra' ] ) ) {
......
......@@ -8,7 +8,8 @@ return apply_filters( 'ninja_forms_action_email_settings', array(
'fields_save_toggle' => array(
'name' => 'fields_save_toggle',
'type' => 'radio',
'type' => 'button_toggle',
'width' => 'full',
'options' => array(
array( 'label' => __( 'Save All', 'ninja-forms' ), 'value' => 'save_all' ),
array( 'label' => __( 'Save None', 'ninja-forms' ), 'value' => 'save_none' )
......@@ -17,5 +18,28 @@ return apply_filters( 'ninja_forms_action_email_settings', array(
'label' => __( 'Fields Save', 'ninja-forms' ),
'value' => 'save_all',
),
/*
|--------------------------------------------------------------------------
| Exception Field
|--------------------------------------------------------------------------
*/
'exception_fields' => array(
'name' => 'exception_fields',
'type' => 'option-repeater',
'label' => __( 'Except', 'ninja-forms' ) . ' <a href="#" class="nf-add-new">' .
__( 'Add New', 'ninja-forms' ) . '</a>',
'width' => 'full',
'group' => 'primary',
'tmpl_row' => 'nf-tmpl-save-field-repeater-row',
'value' => array(),
'columns' => array(
'form_field' => array(
'header' => __( 'Form Field', 'ninja-forms' ),
'default' => '',
'options' => array(),
),
),
),
));
......@@ -554,6 +554,31 @@ Label Three, value-three, 3
</script>
<script id="tmpl-nf-edit-setting-button_toggle" type="text/template">
<span class="nf-setting-label">{{{ data.label }}}{{{ data.renderTooltip() }}}</span>
<div class="nf-setting" style="background: grey; padding: 5px;">
<#
_.each( data.options, function( option ) {
#>
<span class="nf-button primary {{{ data.value != option.value ?
"disabled": "" }}} class="width:
50%;"
data-option_value="{{{ option
.value }}}">{{{ option
.label
}}}</span>
<input type="radio" style="display:none;" value="{{{ option.value
}}}" name="{{{
data.name }}}" {{{ data.value == option.value ? "checked" : '' }}}>
<#
} );
#>
</div>
</script>
<script id="tmpl-nf-edit-setting-color" type="text/template">
<label for="{{{ data.name }}}" class="{{{ data.renderLabelClasses() }}}">{{{ data.label }}} {{{ data.renderTooltip() }}}</label>
......@@ -708,4 +733,20 @@ Label Three, value-three, 3
</div>
</script>
<script id="nf-tmpl-save-field-repeater-row" type="text/template">
<div>
<span class="dashicons dashicons-menu handle"></span>
</div>
<div>
<# try { #>
{{{ data.renderFieldSelect( 'field', data.field ) }}}
<# } catch ( err ) { #>
<input type="text" class="setting" value="{{ data.field }}" data-id="field" >
<# } #>
</div>
<div>
<span class="dashicons dashicons-dismiss nf-delete"></span>
</div>
</script>
<?php do_action( 'ninja_forms_builder_templates' ); ?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment