Start working on settings field types - #45

This commit is contained in:
Jay Wood
2016-09-30 10:21:29 -04:00
parent 25c2126756
commit 4cc50d7b4d
2 changed files with 48 additions and 8 deletions

View File

@ -81,9 +81,10 @@ class CWV2_Admin {
$this->options_page,
$section['id'],
array(
'id' => $this->option_prefix . $option_data['id'],
'name' => $this->option_prefix . $option_data['id'],
'desc' => $option_data['desc']
'id' => $this->option_prefix . $option_data['id'],
'name' => $this->option_prefix . $option_data['id'],
'desc' => $option_data['desc'],
'options' => isset( $option_data['options'] ) ? $option_data['options'] : false,
)
);
}
@ -307,9 +308,9 @@ class CWV2_Admin {
),
),
array(
'id' => 'entry-settings',
'name' => __( 'Dialog Settings', 'content-warning-v2' ),
'group' => 'def_group',
'id' => 'entry-settings',
'name' => __( 'Dialog Settings', 'content-warning-v2' ),
'group' => 'def_group',
'fields' => array(
array(
'id' => 'd_title',

View File

@ -6,29 +6,68 @@ class CWV2_Settings {
public function def_group() {
}
public function check( $args = array() ) {
/**
* Just gets a default set of arguments to make sure they're always set.
*
* @param $args
*
* @author JayWood
* @return array
*/
private function get_default_args( $args ) {
return wp_parse_args( $args, array(
'id' => '',
'name' => '',
'desc' => '',
'default' => '',
'options' => false,
) );
}
public function check( $args = array() ) {
$args = $this->get_default_args( $args );
$field_id = $args['id'];
$description = $args['desc'];
$options = $args['options'];
if ( ! $options ) {
return;
}
?><fieldset><?php
foreach ( $options as $id => $label ) {
}
?></fieldset><?php
}
public function number( $args = array() ) {
}
public function text( $args = array() ) {
}
public function radio( $args = array() ) {
}
public function media( $args = array() ) {
}
public function color( $args = array() ) {
}
public function textbox( $args = array() ) {
}
private function _text_input( $args = array() ) {
public function editor( $args = array() ) {
}
}