dsawardekar / wp-options-manager
Object Oriented Settings API for WordPress that supports Multisite
0.2.0
2014-05-11 12:53 UTC
Requires
- dsawardekar/wordpress-twig-helper: ~0.2.0
- vlucas/valitron: ~1.1.5
Requires (Dev)
- dsawardekar/encase-php: ~0.1.1
- phpunit/phpunit: ~3.7.0
This package is not auto-updated.
Last update: 2024-11-09 16:06:34 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 } }