Yes, I am writing this instead of watching the new season of Game of Thrones. That’s how serious I am about coding this project. You’re welcome.
Added tabs to the new admin interface. The Thank You Page tab now works. I also added the Log tab, but to this I added an entire system information dump in addition to the previous Seamless Donations log dump. This way, if diagnostics are necessary, we can dig through and get a lot more information.
Refactored the three custom post types: donors, donations, and funds and put their definitions in a cpt folder. Also refactored the admin-new folder to just be admin. Finally, renamed the new-admin-loader to just admin-loader and placed at the top level. All of this is so only tabs go into admin and only custom post types go into cpt.
Moved all the legacy import code from Allen’s old version into inc/legacy.php. This leaves the admin folder dedicated to the management of the admin tabs only.
Instructional tabs created for Donors, Donations, and Funds tabs
Since these tabs are no longer relevant (the data is now on the admin menu in custom post types), these tabs have been reconstructed as instructional tabs with a picture showing where the new menus are located. Once a user learns where the data has moved, he can hide these tabs to get them out of the way.
Standardizing admin naming conventions
- Format for each admin tab is seamless_donations_admin_[tab-name]. There are no underscores in the tab name
- The page slug gets the same name
- The file containing the admin tab is named [tab-name] and is located in the admin folder
- The tab configuration function seamless_donations_admin_[tab-name] calls seamless_donations_admin_[tab-name]_menu to set up the menu for the tab.
- Each section in the tab is defined by the function seamless_donations_admin_[tab-name]_section_[section-name]. No underscores in the section name.
This function builds the sections and options for each UI section. It’s passed an options array and an optional section array. The arrays are constructed per the instructions for Admin Page Framework, with some tweaks to maintain Seamless Donations legacy compatibility. If the value of ‘field_id’ matches that of an existing global, that global will be read in and set as that field’s default.
Admin tab filters and actions
Each admin tab now has a full set of filters and actions. The filter and action names are based on the naming conventions described above. These actions are now available:
- seamless_donations_admin_[tab-name]_before: called before the tab and menu are instantiated
- seamless_donations_admin_[tab-name]_after: called after all of the other tab display operations are completed
These filters are now also available:
- seamless_donations_admin_[tab-name]_menu: passes the full menu array prior to instantiating the menu
- seamless_donations_admin_[tab-name]_section_[section-name]: passes the section definition array prior to instantiating the section
- seamless_donations_admin_[tab-name]_section_[section-name]_options: passes the option definition array prior to instantiating the options list
These filters are enormously powerful because they allow complete control of everything on the admin UI tabs for Seamless Donations. The actual contents of the arrays are managed by Admin Page Framework, so you can easily add (or remove) a wide variety of features at any point in the admin page.
Current tab names are donations, donors, templates, forms, funds, help, logs, main, settings, and thanks.
Still to do
There is still work to be done in the admin UI. Certain specific elements need attention next:
- The donations, donors, and funds tabs each have a “permanently hide this tab” button. That needs to be wired and the various conditional logic elements need to be added to hide the tabs if the buttons have been clicked. Might be useful to have a “show all tabs” button somewhere in settings.
- The APF validation code segment is being used as both validation and options saving. This has been coded for a few tabs, but has not been either standardized or optimized. This needs to have the same treatment as the options display code for process_addSettingsFields_with_options().
- Filters and actions need to be created for the validation modules.
- The forms.php code has only been partially written as transition from Allen’s form-options.php code. I started coding the country/state/province location drop-downs, but they are going to need revealers so states show if the country is ‘US’ and provinces show if the country is ‘CA’.
Since we’re going to need the APF revealer pretty soon in this project, it’s probably time to pay up and license the full APF distribution license. I’ll probably do that this week. That’s a few hundred bucks (plus or minus) and I may need to add a few premium add-ons to this thing to help defray some of these costs. It’s worth it. Using a framework can cut months off of a development schedule and I need to force-multiply my time.