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

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

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

mywebsos/carbon-field-extended-radio-image

Composer 安装命令:

composer require mywebsos/carbon-field-extended-radio-image

包简介

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

README 文档

README

This extension adds a Radio Image 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-image

Usage

To use the Extended Radio Image 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 Image Field' ) )
    ->add_fields( array(
        Field::make( 'extended_radio_image', 'extended_radio_image_field', __( 'Select image' ) )
            ->set_options( array(
                'sky' => 'https://picsum.photos/200/300',
                'ground' => 'https://picsum.photos/300/400',
            ) )
            ->return_format( 'array' ) // label, array or value ( default )
    ) );

You can retrieve the selected option using the following methods:

// Retrieve the label of the selected options
$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
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

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