mywebsos/carbon-field-extended-radio 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mywebsos/carbon-field-extended-radio

Composer 安装命令:

composer require mywebsos/carbon-field-extended-radio

包简介

An extension for Carbon Fields that adds a Radio field with the ability to retrieve either the label, value, or key/value array.

README 文档

README

This extension adds a Radio field to the Carbon Fields library, with the added ability to retrieve either the label, value, or key/value array of the selected option.

Installation

To install the extension, you can use the following command:

composer require mywebsos/carbon-fields-extended-radio

Usage

To use the Extended Radio field in your Carbon Fields container, you can use the following code:

use Carbon_Fields\Container;
use Carbon_Fields\Field;

Container::make( 'post_meta', __( 'Extended Radio Field' ) )
    ->add_fields( array(
        Field::make( 'extended_radio', 'extended_radio_field', __( 'Radio options' ) )
            ->set_options( array(
                'option_1' => 'Option 1',
                'option_2' => 'Option 2',
                'option_3' => 'Option 3',
            ) )
            ->return_format( 'array' ) // label, array or value ( default )
    ) );

You can retrieve the selected option using the following methods:

// Retrieve the label|array|value of the selected option
$value = carbon_get_post_meta( get_the_ID(), $field_name );

Note

Make sure to include the use statement of Carbon_Fields\Field at the top of your file.

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2023-01-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固