Skip to content

Commit

Permalink
code formatting and spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
mecachisenros committed Oct 21, 2018
1 parent 057102f commit 8af0db8
Show file tree
Hide file tree
Showing 57 changed files with 937 additions and 930 deletions.
6 changes: 3 additions & 3 deletions caldera-forms-civicrm.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,12 +281,12 @@ private function register_hooks() {
* @since 0.4.4
*/
public function caldera_forms_version_notice() {
?>
?>
<div class="notice notice-error">
<p><?php _e( 'Caldera Forms CiviCRM requires Caldera Forms v1.7 or higher.', 'caldera-forms-civicrm' ); ?></p>
</div>
<?php
}
<?php
}

/**
* Load translation files.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@
class CiviCRM_Caldera_Forms_Contact_Reference {

/**
* Plugin reference.
*
* @since 0.4.4
*/
public $plugin;

/**
* Field key name.
*
* @since 0.4.4
* @var string $key_name Field key name
*/
public $key_name = 'civicrm_contact_reference';
* Plugin reference.
*
* @since 0.4.4
*/
public $plugin;

/**
* Field key name.
*
* @since 0.4.4
* @var string $key_name Field key name
*/
public $key_name = 'civicrm_contact_reference';

/**
* Initialises this object.
Expand Down
4 changes: 2 additions & 2 deletions fields/civicrm_contact_reference/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@
$( '.{{_id}}_contact_type select' ).on( 'change', function() {
var selected = $( this ).val();
$( '.{{_id}}_new_organization' ).toggle( selected == 'Organization' );
if ( selected != 'Organization' )
$( '.{{_id}}_new_organization input' ).prop( 'checked', false );
if ( selected != 'Organization' )
$( '.{{_id}}_new_organization input' ).prop( 'checked', false );
} ).trigger( 'change' );
} );
</script>
Expand Down
32 changes: 16 additions & 16 deletions fields/civicrm_contact_reference/field.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
contact_id: '<?php echo esc_attr( $field['config']['default'] ); ?>',
action: 'civicrm_contact_reference_get',
field_id: $( '#<?php echo esc_attr( $field_id ); ?>' ).data( 'field' ),
form_id: '<?php echo esc_attr( $form['ID'] ); ?>',
form_id: '<?php echo esc_attr( $form['ID'] ); ?>',
nonce: $( '#<?php echo esc_attr( $field_id ); ?>' ).attr( 'nonce' )
},
success : function( response ) {
Expand All @@ -45,21 +45,21 @@
} );
}
$( '#<?php echo esc_attr( $field_id ); ?>' ).cfcSelect2( {
ajax: {
url: cfc.url,
dataType: 'json',
type: 'post',
delay: 250,
data: function ( params ) {
return {
search: params.term,
action: 'civicrm_contact_reference_get',
field_id: $( '#<?php echo esc_attr( $field_id ); ?>' ).data( 'field' ),
form_id: '<?php echo esc_attr( $form['ID'] ); ?>',
nonce: $( '#<?php echo esc_attr( $field_id ); ?>' ).attr( 'nonce' )
};
},
processResults: function( data ) {
ajax: {
url: cfc.url,
dataType: 'json',
type: 'post',
delay: 250,
data: function ( params ) {
return {
search: params.term,
action: 'civicrm_contact_reference_get',
field_id: $( '#<?php echo esc_attr( $field_id ); ?>' ).data( 'field' ),
form_id: '<?php echo esc_attr( $form['ID'] ); ?>',
nonce: $( '#<?php echo esc_attr( $field_id ); ?>' ).attr( 'nonce' )
};
},
processResults: function( data ) {
var options = [];
if ( data ) {
$.each( data, function( index, contact ) {
Expand Down
30 changes: 15 additions & 15 deletions fields/civicrm_country/class-civicrm-country.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@
class CiviCRM_Caldera_Forms_Field_Country {

/**
* Plugin reference.
*
* @since 0.4.4
*/
public $plugin;

/**
* Field key name.
*
* @since 0.4.4
* @var string Field key name
*/
public $key_name = 'civicrm_country';
* Plugin reference.
*
* @since 0.4.4
*/
public $plugin;

/**
* Field key name.
*
* @since 0.4.4
* @var string Field key name
*/
public $key_name = 'civicrm_country';

/**
* Initialises this object.
Expand Down Expand Up @@ -96,9 +96,9 @@ public function register_field_type( $field_types ) {
public function field_render_view( $field_value, $field, $form ) {

// use API to retrieve Country name
$country_data = civicrm_api3( 'Country', 'get', array(
$country_data = civicrm_api3( 'Country', 'get', [
'id' => $field_value,
));
] );

// set as view if we get one
if ( $country_data['is_error'] == '0' ) {
Expand Down
18 changes: 9 additions & 9 deletions fields/civicrm_country/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
</div>
</div>
<div class="caldera-config-group">
<label><?php _e( 'Default', 'caldera-forms-civicrm' ); ?></label>
<label><?php _e( 'Default', 'caldera-forms-civicrm' ); ?></label>
<div class="caldera-config-field">
<select id="{{_id}}_default" class="block-input field-config" name="{{_name}}[default]" value="{{default}}">
<option value="" {{#is default value=""}}selected="selected"{{/is}}></option>
<?php foreach( $countries['values'] as $key => $value ) { ?>
<option value="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['name'] ); ?></option>
<?php } ?>
</select>
<option value="" {{#is default value=""}}selected="selected"{{/is}}></option>
<?php foreach( $countries['values'] as $key => $value ) { ?>
<option value="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['name'] ); ?></option>
<?php } ?>
</select>
</div>
</div>
{{#script}}
if('{{default}}'){
jQuery('#{{_id}}_default').val('{{default}}');
}
if('{{default}}'){
jQuery('#{{_id}}_default').val('{{default}}');
}
{{/script}}
24 changes: 12 additions & 12 deletions fields/civicrm_file/advanced_file_config.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<div class="caldera-config-group">
<label role="presentation"></label>
<div class="caldera-config-field">
<label for="{{_id}}_civicrm_file_upload">
<input id="{{_id}}_civicrm_file_upload" type="checkbox" class="field-config" name="{{_name}}[civicrm_file_upload]" {{#if civicrm_file_upload}}checked="checked"{{/if}} value="1">
<?php _e( 'CiviCRM File Upload', 'caldera-forms-civicrm' ); ?></label>
</div>
<label role="presentation"></label>
<div class="caldera-config-field">
<label for="{{_id}}_civicrm_file_upload">
<input id="{{_id}}_civicrm_file_upload" type="checkbox" class="field-config" name="{{_name}}[civicrm_file_upload]" {{#if civicrm_file_upload}}checked="checked"{{/if}} value="1">
<?php _e( 'CiviCRM File Upload', 'caldera-forms-civicrm' ); ?></label>
</div>
</div>
{{#script}}
jQuery( document ).ready( function( $ ){
$('#{{_id}}_civicrm_file_upload').change(function(){
if( $(this).prop('checked') ){
$('#{{_id}}_attach').prop('checked', false);
$('#{{_id}}_attach').prop('checked', false);
$('#{{_id}}_media_library').prop('checked', false);
$('#{{_id}}_attach').hide();
$('#{{_id}}_attach').parent().parent().hide();
$('#{{_id}}_attach').hide();
$('#{{_id}}_attach').parent().parent().hide();
$('#{{_id}}_media_library').hide();
$('#{{_id}}_media_library').parent().parent().hide();
}else{
$('#{{_id}}_attach').show();
$('#{{_id}}_attach').parent().parent().show();
} else {
$('#{{_id}}_attach').show();
$('#{{_id}}_attach').parent().parent().show();
$('#{{_id}}_media_library').parent().parent().show();
$('#{{_id}}_media_library').show();
}
Expand Down
12 changes: 6 additions & 6 deletions fields/civicrm_file/class-civicrm-file.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
class CiviCRM_Caldera_Forms_Field_File {

/**
* Plugin reference.
*
* @since 0.4.4
*/
public $plugin;
* Plugin reference.
*
* @since 0.4.4
*/
public $plugin;

/**
* CiviCRM file mapping fields.
Expand Down Expand Up @@ -60,7 +60,7 @@ public function register_hooks() {
*
* @param array|string|callable $handler Callable
* @param array $form Form config
* @param array $field Field config
* @param array $field Field config
* @return array $handler The custom upload callback
*/
public function civicrm_upload_handler( $handler, $form, $field ) {
Expand Down
24 changes: 12 additions & 12 deletions fields/civicrm_file/file_config.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
<div class="caldera-config-group">
<label role="presentation"></label>
<div class="caldera-config-field">
<label for="{{_id}}_civicrm_file_upload">
<input id="{{_id}}_civicrm_file_upload" type="checkbox" class="field-config" name="{{_name}}[civicrm_file_upload]" {{#if civicrm_file_upload}}checked="checked"{{/if}} value="1">
<?php _e( 'CiviCRM File Upload', 'caldera-forms-civicrm' ); ?></label>
</div>
<label role="presentation"></label>
<div class="caldera-config-field">
<label for="{{_id}}_civicrm_file_upload">
<input id="{{_id}}_civicrm_file_upload" type="checkbox" class="field-config" name="{{_name}}[civicrm_file_upload]" {{#if civicrm_file_upload}}checked="checked"{{/if}} value="1">
<?php _e( 'CiviCRM File Upload', 'caldera-forms-civicrm' ); ?></label>
</div>
</div>
{{#script}}
jQuery( document ).ready( function( $ ){
$('#{{_id}}_civicrm_file_upload').change(function(){
if( $(this).prop('checked') ){
$('#{{_id}}_attach').prop('checked', false);
$('#{{_id}}_attach').prop('checked', false);
$('#{{_id}}_allow_multiple').prop('checked', false);
$('#{{_id}}_media_library').prop('checked', false);
$('#{{_id}}_attach').hide();
$('#{{_id}}_attach').parent().parent().hide();
$('#{{_id}}_attach').hide();
$('#{{_id}}_attach').parent().parent().hide();
$('#{{_id}}_allow_multiple').hide();
$('#{{_id}}_allow_multiple').parent().parent().hide();
$('#{{_id}}_media_library').hide();
$('#{{_id}}_media_library').parent().parent().hide();
$('#{{_id}}_allow_multiple_text_wrap').hide();
}else{
$('#{{_id}}_attach').show();
$('#{{_id}}_attach').parent().parent().show();
} else {
$('#{{_id}}_attach').show();
$('#{{_id}}_attach').parent().parent().show();
$('#{{_id}}_allow_multiple').show();
$('#{{_id}}_allow_multiple').parent().parent().show();
$('#{{_id}}_media_library').parent().parent().show();
Expand Down
26 changes: 13 additions & 13 deletions fields/civicrm_state/class-civicrm-state.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@
class CiviCRM_Caldera_Forms_Field_State {

/**
* Plugin reference.
*
* @since 0.4.4
*/
public $plugin;

/**
* Field key name
*
* @since 0.4.4
* @var string $key_name The field key name
*/
public $key_name = 'civicrm_state';
* Plugin reference.
*
* @since 0.4.4
*/
public $plugin;

/**
* Field key name
*
* @since 0.4.4
* @var string $key_name The field key name
*/
public $key_name = 'civicrm_state';

/**
* Initialises this object.
Expand Down
36 changes: 18 additions & 18 deletions fields/civicrm_state/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,27 @@
<input type="text" id="{{_id}}_placeholder" class="block-input field-config" name="{{_name}}[placeholder]" value="{{placeholder}}">
</div>
</div>
<div class="caldera-config-group">
<label><?php _e( 'Default', 'caldera-forms-civicrm' ); ?></label>
<div class="caldera-config-field">
<select id="{{_id}}_default" class="block-input field-config" name="{{_name}}[default]" value="{{default}}">
<option value="" {{#is default value=""}}selected="selected"{{/is}}></option>
<?php foreach( $state as $key => $value ) { ?>
<option value="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $value['name'] ); ?></option>
<?php } ?>
</select>
</div>
<div class="caldera-config-group">
<label><?php _e( 'Default', 'caldera-forms-civicrm' ); ?></label>
<div class="caldera-config-field">
<select id="{{_id}}_default" class="block-input field-config" name="{{_name}}[default]" value="{{default}}">
<option value="" {{#is default value=""}}selected="selected"{{/is}}></option>
<?php foreach( $state as $key => $value ) { ?>
<option value="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $value['name'] ); ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="caldera-config-group">
<label for="{{_id}}_default"><?php esc_html_e('CiviCRM Country field'); ?></label>
<div class="caldera-config-field">
<input type="text" id="{{_id}}_civicrm_country" class="block-input field-config magic-tag-enabled" name="{{_name}}[civicrm_country]" value="{{civicrm_country}}">
<p class="description">The CiviCRM Country field <strong>slug</strong> for which the states should sync (needed when more than one Country/State fields are present in a form).</p>
</div>
<label for="{{_id}}_default"><?php esc_html_e('CiviCRM Country field'); ?></label>
<div class="caldera-config-field">
<input type="text" id="{{_id}}_civicrm_country" class="block-input field-config magic-tag-enabled" name="{{_name}}[civicrm_country]" value="{{civicrm_country}}">
<p class="description">The CiviCRM Country field <strong>slug</strong> for which the states should sync (needed when more than one Country/State fields are present in a form).</p>
</div>
</div>

{{#script}}
if('{{default}}'){
jQuery('#{{_id}}_default').val('{{default}}');
}
if('{{default}}'){
jQuery('#{{_id}}_default').val('{{default}}');
}
{{/script}}
Loading

0 comments on commit 8af0db8

Please sign in to comment.