Git Product home page Git Product logo

hilkiahmakemo / silverstripe-multivaluefield Goto Github PK

View Code? Open in Web Editor NEW

This project forked from symbiote/silverstripe-multivaluefield

0.0 1.0 0.0 167 KB

A fieldtype that makes it possible to store arrays of data (serialised) in the DB. Useful if you have many fields that you don't want to normalise out over many joins

License: BSD 3-Clause "New" or "Revised" License

PHP 93.64% CSS 1.91% JavaScript 4.45%

silverstripe-multivaluefield's Introduction

SilverStripe MultiValueField module

Build Status SilverStripe supported module

Notes:

  • The SilverStripe 2.4 compatible version of the module is still available in the ss24 branch
  • The SilverStripe 3.x compatible versions are still available in the 2.x branches. (see version info)

A database field type that allows the storage of multiple discrete values in a single database field. This also provides form fields for entering multiple values in a simple manner

  • MultiValueTextField - displays a text field. When data is entered, another text field is displayed directly beneath. Subsequent data entry triggers more text fields to appear
  • MultiValueDropdownField - displays a dropdown field. When a value is selected another dropdown field is displayed.

Within templates, the field can be iterated over as per a data object set. The property $Value is available as a Varchar type, and other typical properties such as $FirstLast etc are inherited from ViewableData.

Data is stored in the database in a serialized PHP format. While this is not ideal for searching purposes, some external indexing engines (eg the Solr module) are aware of the field type and will index accordingly.

Version info

This version of MultiValueField supports SilverStripe 4.0.0

Older versions of SilverStripe are supported on minor version branches below

Basic Usage

As with all DB fields

private static $db = array(
    'Keywords'  => 'MultiValueField',
);

To make use of the field on the frontend, you can loop over the Items property

<% loop $Keywords.Items %>

<p>$Key $Value</p>

<% end_loop %>

In this case, $Value is a Varchar object, so you can call all relevant string field methods on it, such as $Value.Raw, $Value.LimitWordCount etc etc.

Note that to have the $Key value available as something other than an integer, use the KeyValueField field type to populate the field.

Maintainer Contacts

Requirements

  • SilverStripe 4.0

Contributing

Thanks

Translations

Translations of the natural language strings are managed through a third party translation interface, transifex.com. Newly added strings will be periodically uploaded there for translation, and any new translations will be merged back to the project source code.

Please use https://www.transifex.com/projects/p/silverstripe-multivaluefield to contribute translations, rather than sending pull requests with YAML files.

License

This module is licensed under the BSD license at http://silverstripe.org/BSD-license

Project Links

silverstripe-multivaluefield's People

Contributors

nyeholt avatar ajshort avatar dhensby avatar chillu avatar robbieaverill avatar mateusz avatar cjsewell avatar drmartingonzo avatar ryanwachtl avatar drzax avatar a2nt avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.