Last active
April 14, 2016 08:06
-
-
Save andreasnrb/3e4c1a6fa2c80b29de97cd034478d4f8 to your computer and use it in GitHub Desktop.
Options framework example. Still work in progress and changes weekly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function setup_example_page() | |
{ | |
$page = new Page('sf-example-page'); | |
$accordion = new Accordion(); | |
$page->add($accordion); | |
do_action('sf-example-page', [$accordion]); | |
$save = new Row(); | |
$save->add(new NonceField('save-example-settings')); | |
$save->add(new SaveButton()); | |
$save->add(new Row('notifications')); | |
$page->add($save); | |
return $page; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('sf-example-page', 'examplePage' ); | |
public function examplePage(IElementGroup $page) { | |
$section = new Section('General settings'); | |
$section->add(UIFactory::inputTextField('setting_key', | |
'Setting label', | |
'Setting description.' | |
)); | |
$page->add($section); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="wrap so-fo"> | |
<h2>Example page</h2> | |
<div id="sf-examples-wrap"> | |
<form action="<?php echo admin_url('admin.php?controller=settings&action=save')?>" method="post"> | |
<?php $page->render() ?> | |
</form> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment