dsawardekar/wp-options-manager

Object Oriented Settings API for WordPress that supports Multisite

0.2.0 2014-05-11 12:53 UTC

This package is not auto-updated.

Last update: 2024-12-21 16:36:17 UTC


README

Options API for WordPress

Deprecated. This repo has been merged into Arrow.

Usage

$container->object('script', new \WpOptionsManager\OptionsManager($container));
$container->singleton('optionsValidator', 'MyOptionsValidator');
$container->singleton('optionsPage', 'MyOptionsPage');

class MyOptionsPage extends \WpOptionsManager\OptionsPage {

  function getTemplateContext() {
    return array(
      'foo' => $this->getOption('foo')
    );
  }

}

class MyOptionsValidator extends \WpOptionsManager\OptionsValidator {

  function loadRules($validator) {
    $validator->rule('required', 'foo');
    $validator->rule('length', 3);
    // more Valitron rules
  }

}