'',
'placeholder' => '',
'classes' => [],
'std' => '',
'desc' => '',
];
$field = array_merge( $defaults, $field );
$method_name = '_' . $field['type'];
if ( ! method_exists( __CLASS__, $method_name ) ) {
$method_name = '_text';
}
self::$method_name( $field );
}
/**
* @static
* @since 1.0.0
* @access private
*/
private static function _text( array $field ) {
if ( empty( $field['classes'] ) ) {
$field['classes'] = [ 'regular-text' ];
}
?>
/>
$option_value ) :
?>
[],
];
$field = array_merge( $defaults, $field );
$post_types_objects = get_post_types(
[
'public' => true,
], 'objects'
);
$field['options'] = [];
foreach ( $post_types_objects as $cpt_slug => $post_type ) {
if ( in_array( $cpt_slug, $field['exclude'] ) ) {
continue;
}
$field['options'][ $cpt_slug ] = $post_type->labels->name;
}
self::_checkbox_list( $field );
}
/**
* @static
* @since 1.0.0
* @access private
*/
private static function _checkbox_list_roles( array $field ) {
$defaults = [
'exclude' => [],
];
$field = array_merge( $defaults, $field );
$field['options'] = [];
foreach ( get_editable_roles() as $role_slug => $role_data ) {
if ( in_array( $role_slug, $field['exclude'] ) ) {
continue;
}
$field['options'][ $role_slug ] = $role_data['name'];
}
self::_checkbox_list( $field );
}
/**
* @static
* @since 1.0.0
* @access private
*/
private static function _raw_html( array $field ) {
if ( empty( $field['html'] ) ) {
return;
}
?>