primoz2500/hasoneautocompletefield
最新稳定版本:3.0.1
Composer 安装命令:
composer require primoz2500/hasoneautocompletefield
包简介
A CMS form field for adding has_one relationships using autocomplete
README 文档
README
Overview
This module adds a field for using an autocomplete dropdown to assign a has_one relationship. It's styled after the URLSegment field.
FORK CHANGES: Added support for functions as result list title ( fields are accessible as get{FieldName} functions just with the function name )
Maintainer Contacts
- Nathan Cox (nathan@flyingmonkey.co.nz)
- Primoz Skerbis (primoz2500@gmail.com)
Requirements
- SilverStripe 4.0+
For SilverStripe 3.x see the version 1 branch on Github: https://github.com/nathancox/silverstripe-hasoneautocompletefield/tree/1
Installation Instructions
Via composer:
composer require primoz2500/hasoneautocompletefield
Or manually download the module and place it in a folder called hasoneautocompletefield in your site root.
Visit yoursite.com/dev/build?flush=1
Documentation
Example code:
<?php use SilverStripe\CMS\Model\SiteTree; use NathanCox\HasOneAutocompleteField\Forms\HasOneAutocompleteField; class Page extends SiteTree { private static $db = []; private static $has_one = [ 'LinkedPage' => 'Page' ]; public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab('Root.Content', $pageField = HasOneAutocompleteField::create('LinkedPageID', 'Linked Page', 'Page', 'Title')); $pageField->setSearchFields(array('Title', 'Content')); $pageField->enableClearButton(); return $fields; } }
Known Issues
统计信息
- 总下载量: 2k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-05-05