Skip to content

Commit

Permalink
Feature: tweaks to accommodate per-form settings for the PDF receipts…
Browse files Browse the repository at this point in the history
… addon (#6912)
  • Loading branch information
glaubersilva authored Sep 21, 2023
1 parent 02f37e3 commit b513ccd
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/DonationForms/Properties/FormSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ class FormSettings implements Arrayable, Jsonable
*/
public $donateButtonCaption;

/**
* @var array
*/
public $pdfSettings;

/**
* @since 3.0.0
Expand Down Expand Up @@ -226,6 +230,8 @@ public static function fromArray(array $array): self

$self->offlineDonationsInstructions = $array['offlineDonationsInstructions'] ?? '';

$self->pdfSettings = isset($array['pdfSettings']) && is_array($array['pdfSettings']) ? $array['pdfSettings'] : [];

return $self;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {createSlotFill} from '@wordpress/components';
import {__} from '@wordpress/i18n';
import {setFormSettings, useFormState, useFormStateDispatch} from '@givewp/form-builder/stores/form-state';

import TabPanel from '../TabPanel';

Expand All @@ -22,6 +23,19 @@ import {brush, settings} from '@wordpress/icons';

const {Slot: InspectorSlot, Fill: InspectorFill} = createSlotFill('StandAloneBlockEditorSidebarInspector');

declare const window: {
givewp: {
form: {
settings: {
setFormSettings: typeof setFormSettings;
useFormState: typeof useFormState;
useFormStateDispatch: typeof useFormStateDispatch;
};
};
};
} & Window;
window.givewp.form.settings = {setFormSettings, useFormState, useFormStateDispatch};

const tabs = [
{
name: 'form',
Expand All @@ -44,6 +58,7 @@ const tabs = [
<DonationConfirmation />
<FormGridSettings />
<EmailSettings />
{wp.hooks.applyFilters('givewp_form_builder_pdf_settings', '')}
</>
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,27 @@
}
}

.components-modal__header {
box-shadow: inset 0 -1px 0 0 #ddd;
}

.components-modal__header-heading {
top: 1rem !important;
font-size: 1rem !important;
line-height: 1.5 !important;
margin-top: -0.2rem !important;
}

.components-modal__header {
height: 3.5rem !important;
padding: 16px 32px 8px !important;
}

.components-modal__content {
margin-top: 3.25rem;

}

/*
Add border bottom to tabs, while removing body top border.
This creates a consistent separator between the tabs and the rest of the sidebar.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
height: 100%;
overflow: hidden;
flex: 1;

margin-top: 1.5rem;
.components-text-control__input {
height: 2.25rem;
}
Expand All @@ -99,7 +99,7 @@
&__close-btn {
z-index: 11;
position: absolute;
top: 0;
top: -0.4rem;
right: 0;
display: flex;
gap: var(--givewp-spacing-3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ export type FormSettings = {
offlineDonationsCustomize: boolean;
offlineDonationsInstructions: string;
donateButtonCaption: string;
pdfSettings: object;
};

0 comments on commit b513ccd

Please sign in to comment.