Download the PHP package underpin/admin-page-loader without Composer
On this page you can find all versions of the php package underpin/admin-page-loader. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download underpin/admin-page-loader
More information about underpin/admin-page-loader
Files in underpin/admin-page-loader
Package admin-page-loader
Short Description Admin Page Loader for Underpin
License GPL-2.0-or-later
Informations about the package admin-page-loader
Underpin Admin Page Loader
Loader That assists with adding admin pages to a WordPress website.
Installation
Using Composer
composer require underpin/admin-page-loader
Manually
This plugin uses a built-in autoloader, so as long as it is required before Underpin, it should work as-expected.
require_once(__DIR__ . '/underpin-admin-pages/admin-pages.php');
Setup
- Install Underpin. See Underpin Docs
- Register new admin Pages as-needed.
Basic Example
A very basic example could look something like this. This example would display a single text field on a settings page, and handle field saving using Underpin's fields API.
Multiple Sections
The admin screen is broken into sections. This makes it possible to quickly change the layout of the page into various display types, such as a tabular layout. This example would display all of the sections on a single page.
Sections as Tabs
To change the display to use tabs, simply set the type
argument to tabs
.
Customizing Templates
By default, layouts are intentionally built to match WordPress. The intent is to provide a fast way to build Admin pages, something that is typically a time-consuming task. There are many ways to extend how this page behaves, however.
Option 1: Create Custom Settings Fields
All of the field rendering happens inside Setting_Field::place
. In-other words, if you create a custom Setting Field,
it is possible to create a custom template for a field, and customize how that field behaves when it is saved.
Option 2: Extend Admin_Page to include custom layouts
Another option is to extend the relevant functions in Admin_Page
with your own behavior.
By doing so, you will be able to create your own template files that can be used instead of the defaults.
It's not shown here, but you could also extend pretty much everything, including how options are saved, and where things get saved.
You could then use this factory just like you would normally, only now you must specify the class to use instead of the default.