2017 © Pedro Peláez
 

library wp-plugin-settings

Generate WordPress plugin settings from a config file.

image

carawebs/wp-plugin-settings

Generate WordPress plugin settings from a config file.

  • Wednesday, February 7, 2018
  • by DavidEgan
  • Repository
  • 1 Watchers
  • 0 Stars
  • 35 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Generate WordPress Settings

This package is in development and is not suitable for production yet., (*1)

Configuring plugin settings with the WordPress settings API can be a bit tricky., (*2)

It's difficult to keep your code DRY, and the relationship between the different functions can be tricky to set up., (*3)

It makes sense to register settings the WordPress way because your code may well have to play nicely with other developers who you're never going to meet. It also has to robust enough to survive future WordPress upgrades., (*4)

The downside of this is that you need to manage the relationship between register_setting(), add_settings_field(), add_settings_section(), add_settings_field(), settings_fields(), do_settings_sections() etc...just to output a simple form that saves a value to the WP options table., (*5)

This package is a first stab at abstracting the settings setup. You just pass in a config file which returns a PHP array. This is used to configure settings., (*6)

Usage

$optionsPageConfig = dirname(__FILE__) . '/options-page-config.php';
$menuPageConfig = dirname(__FILE__) . '/menu-page-settings-config.php';
// Settings Page
$optionsPage = new SettingsController;
$optionsPage->setOptionsPageArgs($optionsPageConfig)->initOptionsPage();

TODO

Build a fluent interface so you can add settings pages like:, (*7)

<?php
$settingsPage = new Carawebs\Settings\SettingsPage($pageData);
$settingsPage->newTab('Social Media')->withSection($sectionData)->withFields($fieldsData);

The Versions

07/02 2018

dev-master

9999999-dev

Generate WordPress plugin settings from a config file.

  Sources   Download

GPL2 GPL-2.0-only

28/04 2017

1.0.4

1.0.4.0

Generate WordPress plugin settings from a config file.

  Sources   Download

GPL2

31/03 2017

1.0.3

1.0.3.0

Generate WordPress plugin settings from a config file.

  Sources   Download

GPL2

29/03 2017

1.0.1

1.0.1.0

Generate WordPress plugin settings from a config file.

  Sources   Download

GPL2

29/03 2017

1.0.2

1.0.2.0

Generate WordPress plugin settings from a config file.

  Sources   Download

GPL2

29/03 2017

1.0.0

1.0.0.0

Generate WordPress plugin settings from a config file.

  Sources   Download

GPL2