承接 adrhumphreys/silverstripe-textdropdownfield 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

adrhumphreys/silverstripe-textdropdownfield

最新稳定版本:2.0.0

Composer 安装命令:

composer require adrhumphreys/silverstripe-textdropdownfield

包简介

A text field combined with a dropdown field.

README 文档

README

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

Requirements

  • PHP ^8.3
  • SilverStripe ^6

Installation

composer require adrhumphreys/silverstripe-textdropdownfield dev-master

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\TextDropdownField\TextDropdownField;
use SilverStripe\ORM\DataObject;

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

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

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

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

        return $fields;
    }
}

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

Maintainers

Development and contribution

Smash that PR button 🥰

统计信息

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

GitHub 信息

  • Stars: 10
  • Watchers: 3
  • Forks: 4
  • 开发语言: JavaScript

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2020-08-26