The locations interface needs a major overhaul.
Let’s investigate the process and where we can start shimming some React components.
Research
Main Loader : Locations | Location Details (SaaS) Menu
- \SLP_Admin_UI::create_admin_menu
- The main hook attached to \SLP_Admin_UI::$menu_items[‘slp_manage_locations‘]
- When clicked, fires \SLP_Admin_UI::renderLocationsPage
- Which calls \SLP_Admin_Locations::display
Locations Page Header (UI)
The locations page is a bastardized combination of the SLP_Settings class and WP_List_Table.
The top-of-page header appears to be handled by SLP_Settings.
SLP_Settings extends SLP_Base_ReactObject
To start rendering the page is calls \SLP_Base_ReactObject::render with these attributes:
– $scriptHandle = ‘slp_settings’
– $scriptFilebase = ‘slp_settings’
This methodology ends up render the SLPSettingsPanel React component (wp-content/plugins/store-locator-plus/src/slp_settings/slp_settings.tsx)
That means the page header is rendering using the Reactionary standard <AdminHeader> for the page.
Currently SLP_Settings is only leverage the pageName property, but it also supports sections as a property which is the submenu.
With the 2606.26.01 release the Settings system uses the React AdminHeader menu.
\SLP_Settings::render_settings_page
- $this->sections may have is_topmenu set, this indicates the top level menus in the app
Locations Card (Defunct?)
This may no longer be used: \SLP_Admin_Locations::create_location_details_box
SLP_Admin_Locations
extends WP_List_Table – this is already going to be a shit show. The WP_List_Table interface is from 1902. Maybe before that. It is awful.
Referenced by:
- \MySLP_Admin::do_admin_startup()
- Setting the screen property , probably not needed:
SLP_Admin_Locations::get_instance()->screen = ‘store-locator-plus_page_slp_manage_locations’;
- Setting the screen property , probably not needed:
- \SLP_Power_Pages_Admin::extend_location_edit()
- Only if Store Pages is active, add an edit section to show an “edit Store Page” link
- \SLP_Power_Pages_Admin::set_page_actions()
- Add the recreate store page action hyperlink under each location on the table
- \SLP_Actions::save_screen_options()
- To save the screen options, which is currently only the page (table rows) length.
- \SLP_Admin_Locations_Add::
- initialize
- extended_data_block – for extended data fields
- \SLP_Admin_UI::renderLocationsPage
- To render the UI
- \SLP_Location_LoadFromWP::import
- To only report back any URL the person puts in is invalid.
- This is called from \SLP_Admin_Locations_Actions::process_actions when the current_action is load_from_wp
- This is setup from \SLP_Admin_Locations_Load
- \SLP_Settings_manage_locations_table::display
- A shim for $this->settings->add_ItemToGroup( array(
‘group_params’ => $group_params,
‘type’ => ‘manage_locations_table’,
) );
- A shim for $this->settings->add_ItemToGroup( array(
SLP_Admin_Locations
Hooks & Filters Fired
- slp_locations_manage_bulkactions : creates the list of bulk action dropdown items
- SLP_Power_Admin_Locations
- SLP_Experience_Admin
- SLP_Power_Pages_Admin
- slp_locations_manage_filters : The filter location drop down items
- SLP_Power_Admin
- slp_locations_manage_cssclass : Adds extra CSS classes
- SLP_Experience_Admin
- slp_column_data : Change the data rendered in a column
- slp_manage_locations_actionbar_ui : modify the action bar on top of the table
- slp_modify_admin_locations_script_data : modify the script data for the JavaScript on the page
- slp_manage_location_columns
- pls_manage_location_where
- slp_manage_locations_buttons
- slp_build_locations_panels
Not used:
- slp_invalid_highlight
- slp_edit_location_change_extended_data_info
- slp_manage_expanded_location_columns
Screen for WP_List_Table
This is messing up the UI.
Let’s see if we can drop this, start peeling away layers to simplify this interface as we work toward a React version.
locations_per_page
Tracked via \SLPlus::$userMetaKeys- Stored in user meta via \SLP_AJAX::update_slp_user_meta
- \SLP_Actions::init sets a filter on set-screen-option … it calls…
- \SLP_Actions::save_screen_options … which only runs if the current page is slp_manage_locations… if so it calls…
- \SLP_Admin_Locations::save_screen_options
- Which returns the value of locations_per_page
- \SLP_Admin_Locations::save_screen_options
- \SLP_Actions::save_screen_options … which only runs if the current page is slp_manage_locations… if so it calls…
Best option is to make this a React interface for page length / pagination