Commit 0aa470b0 authored by KR Moorhouse's avatar KR Moorhouse

Removed unnecessary console log. Updated styling for new feature. Added comments to Save.php file.

parent bf72a4a9
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -12,7 +12,7 @@ define( [], function() {
var controller = Marionette.Object.extend( {
initialize: function() {
// We don't want the RTE setting to re-render when the value changes.
nfRadio.channel( 'setting-type-button-toggle' ).reply( 'renderOnChange', function(){ console.log('here');return false } );
nfRadio.channel( 'setting-type-button-toggle' ).reply( 'renderOnChange', function(){ return false; } );
// Respond to requests for field setting filtering.
nfRadio.channel( 'button-toggle' ).reply( 'before:updateSetting', this.updateSetting, this );
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
File mode changed from 100644 to 100755
File mode changed from 100755 to 100644
......@@ -238,19 +238,21 @@
}
}
.button-toggle {
text-align: center;
border: #ccc 1px;
text-align: left;
border: #ccc 1px solid;
border-radius: 5px;
background: #f1f1f1;
margin-top: 5px;
padding: 5px;
margin-top: 35px;
padding: 9px 0px;
width: 100%;
label {
width: 49.5%;
width: 48%;
display: inline-block;
margin-left: 1%;
span {
width: 100%;
display: inline-block;
cursor: pointer;
}
input:checked + span {
background-color: #1ea9ea;
......
......@@ -60,10 +60,13 @@ final class NF_Actions_Save extends NF_Abstracts_Action
$hidden_field_types = apply_filters( 'nf_sub_hidden_field_types', array() );
// For each field on the form...
foreach( $data['fields'] as $field ){
// If this is a "hidden" field type.
if( in_array( $field[ 'type' ], array_values( $hidden_field_types ) ) ) {
$data['actions']['save']['hidden'][] = $field['type'];
// Do not save it.
$data[ 'actions' ][ 'save' ][ 'hidden' ][] = $field[ 'type' ];
continue;
}
......@@ -72,19 +75,25 @@ final class NF_Actions_Save extends NF_Abstracts_Action
$save_all_none = $action_settings[ 'fields-save-toggle' ];
$save_field = true;
// If we were told to save all fields...
if( 'save_all' == $save_all_none ) {
$save_field = true;
// For each exception to that rule...
foreach( $action_settings[ 'exception_fields' ] as
$exception_field ) {
// Remove it from the list.
if( $field[ 'key' ] == $exception_field[ 'field'] ) {
$save_field = false;
break;
}
}
} else if( 'save_none' == $save_all_none ) {
} // Otherwise... (We were told to save no fields.)
else if( 'save_none' == $save_all_none ) {
$save_field = false;
// For each exception to that rule...
foreach( $action_settings[ 'exception_fields' ] as
$exception_field ) {
// Add it to the list.
if( $field[ 'key' ] == $exception_field[ 'field'] ) {
$save_field = true;
break;
......@@ -92,13 +101,17 @@ final class NF_Actions_Save extends NF_Abstracts_Action
}
}
// If we're supposed to save this field...
if( $save_field ) {
// Do so.
$sub->update_field_value( $field['id'], $field['value'] );
}
}
// If we have extra data...
if( isset( $data[ 'extra' ] ) ) {
$sub->update_extra_values( $data['extra'] );
// Save that.
$sub->update_extra_values( $data[ 'extra' ] );
}
do_action( 'nf_before_save_sub', $sub->get_id() );
......
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