定制 bigfork/silverstripe-textdropdowndropdownfield 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

bigfork/silverstripe-textdropdowndropdownfield

最新稳定版本:2.0.0

Composer 安装命令:

composer require bigfork/silverstripe-textdropdowndropdownfield

包简介

A text field combined with two dropdown fields.

README 文档

README

This is a Bigfork-maintained fork of a fork of adrhumphreys/silverstripe-textdropdownfield and so contains opinionated changes.

This version has two dropdowns instead of one. For twice the dropdown-ness.

Text dropdown dropdown field

This lets you add field that is a combination of a dropdown and a dropdown and a text field

Requirements

  • PHP ^7.4 || ^8.0
  • SilverStripe ^4.0 || ^5

Installation

composer require bigfork/silverstripe-textdropdowndropdownfield

Documentation

When using this field you'll need to specify the name of the field, the title for the field, the text relation, the dropdown relation followed by the dropdown source.

An example usecase could look like this:

<?php
declare(strict_types=1);

use AdrHumphreys\TextDropdownDropdownField\TextDropdownDropdownField;
use SilverStripe\ORM\DataObject;

class Example extends DataObject
{
    /**
     * @var string[]
     */
    private static $db = [
        'TextContent' => 'Varchar(20)',
        'DropdownContent' => 'Varchar(20)',
        'SecondDropdownContent' => 'Varchar(20)',
    ];

    public function getCMSFields()
    {
        $fields = parent::getCMSFields();

        $source = [
            'p' => 'Paragraph',
            'h1' => 'Header 1',
            'h2' => 'Header 2',
        ];
        $otherSource = [
            'foo' => 'bar',
        ];

        $fields->addFieldToTab(
            'Root.Main',
            TextDropdownDropdownField::create(
                'NameThatDoesntMatter',
                'Title',
                'TextContent',
                'DropdownContent',
                $source,
                'SecondDropdownContent',
                $otherSource,
        ));

        return $fields;
    }
}

If you want to specifically edit the dropdown or text field you can access those through getTextField, getDropdownField and getSecondDropdownField on the field after it's been created

Maintainers

  • Bigfork

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2025-07-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固