'', 'attributes' => [], 'std' => '', 'desc' => '', ]; $field = array_merge( $defaults, $field ); $method_name = $field['type']; if ( ! method_exists( __CLASS__, $method_name ) ) { $method_name = 'text'; } self::$method_name( $field ); } /** * Render text control. * * Generates the final HTML for text controls. * * @since 2.0.0 * @access private * @static * * @param array $field Field data. */ private static function text( array $field ) { $attributes = []; if ( empty( $field['attributes']['class'] ) ) { $field['attributes']['class'] = 'regular-text'; } foreach ( $field['attributes'] as $attribute_key => $attribute_values ) { $attributes[] = sprintf( '%1$s="%2$s"', $attribute_key, esc_attr( $attribute_values ) ); } $attributes = implode( ' ', $attributes ); ?> />

$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 ); } /** * Render checkbox list control for user roles. * * Generates the final HTML for checkbox list controls populated with user roles. * * @since 2.0.0 * @access private * @static * * @param array $field Field data. */ 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 ); } /** * Render raw HTML control. * * Generates the final HTML for raw HTML controls. * * @since 2.0.0 * @access private * @static * * @param array $field Field data. */ private static function raw_html( array $field ) { if ( empty( $field['html'] ) ) { return; } ?>