承接 silverware/model-filters 相关项目开发

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

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

silverware/model-filters

Composer 安装命令:

composer require silverware/model-filters

包简介

SilverWare Model Filters Module.

README 文档

README

Latest Stable Version Latest Unstable Version License

Extends the SilverStripe v4 ModelAdmin to support filtering of versioned data objects.

Contents

Background

Traditionally, versioning in SilverStripe has been the sole domain of SiteTree objects within the CMS, such as the ubiquitous Page class. With the advent of SilverStripe v4, versioning is now used in other areas of the CMS, such as assets.

You can add versioning to your own model classes by using the Versioned extension. ModelAdmin supports versioned data objects out of the box, however filtering these objects by their status is a bit trickier.

Enter silverware/model-filters. After installation of this module, your versioned data objects will have a status dropdown field added to the filter form that appears within ModelAdmin, allowing the user to filter records by their versioning status:

Record Status Filter

You can also add StatusBadges to your $summary_fields to show the versioning status within your model admin grid field:

Record Status Badges

Requirements

Installation

Installation is via Composer:

$ composer require silverware/model-filters

Usage

Once installed, Versioned data objects within ModelAdmin will be automatically detected and a status field will appear within the filter form for each object.

In order to show status badges within the grid field for your versioned objects, simply add StatusBadges to your $summary_fields static, for example:

private static $summary_fields = [
  ...
  'StatusBadges',
  ...
];

Status Field Positioning

By default, the status dropdown field will be added to the end of your search filter fields for each versioned object. To control where the field appears, add one of the following methods to your ModelAdmin subclass:

public function getStatusFieldBefore()
{
    return 'NameOfField';  // will appear before this field
}
public function getStatusFieldAfter()
{
    return 'NameOfField';  // will appear after this field
}

You could also detect the current model class via $this->modelClass and answer a different field name, if required:

public function getStatusFieldAfter()
{
    switch ($this->modelClass) {
        case FirstModel::class:
            return 'AfterThisField';
        case SecondModel::class:
            return 'AfterAnotherField';
    }
}

Status Field Title

By default, the title of the status dropdown field is "Record status". The title is obtained by calling getStatusFieldTitle() on the ModelAdmin subclass. The method added via the extension supports i18n via the usual SilverStripe conventions, however you can also override the method in your ModelAdmin subclass to answer a different field title:

public function getStatusFieldTitle()
{
    return 'New field title';
}

Issues

Please use the GitHub issue tracker for bug reports and feature requests.

Contribution

Your contributions are gladly welcomed to help make this project better. Please see contributing for more information.

Maintainers

Colin Tucker Praxis Interactive
Colin Tucker Praxis Interactive

License

BSD-3-Clause © Praxis Interactive

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2017-05-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固