2017 © Pedro Peláez
 

silverstripe-vendormodule silverstripe-table-field

Allows to edit tables in wysiwyg style

image

nblum/silverstripe-table-field

Allows to edit tables in wysiwyg style

  • Thursday, March 15, 2018
  • by nblum
  • Repository
  • 1 Watchers
  • 3 Stars
  • 41 Installations
  • JavaScript
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

silverstripe-table-field

Allows to edit tables in wysiwyg style. Saves the result in json., (*1)

screenshot, (*2)

Installation

composer require nblum/silverstripe-table-field

Usage

In model, (*3)

private static $db = [
    'Table' => 'Varchar',
];

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

    $fields->addFieldsToTab('Root.Main', [
        TableField::create('Table', 'Table')
    ]);

    return $fields;
}

public function Table()
{
    return new ArrayList(array_reduce(json_decode($this->dbObject('Table')->value), function ($carry, $row) {
        $carry = is_array($carry) ? $carry : [];
        return array_merge($carry, [['row' => new ArrayList(array_reduce($row, function($carry, $column) {
            $carry = is_array($carry) ? $carry : [];
            return array_merge($carry, [['column' => $column]]);
        }))]]);
    }));
}

In template, (*4)

<table>
    <% loop $Table %>
        <tr>
            <% loop $row %>
                <%-- Using .RAW lets us but <b> tags in the table fields --%>
                <td>$column.RAW</td>
            <% end_loop %>
        </tr>
    <% end_loop %>
</table>

Configuration

There are no configuration options, (*5)

Todos

  • add config options for max rows and cols

The Versions

15/03 2018

dev-master

9999999-dev https://github.com/nblum/

Allows to edit tables in wysiwyg style

  Sources   Download

MIT

The Requires

 

table content silverstripe

15/03 2018

2.0.1

2.0.1.0 https://github.com/nblum/

Allows to edit tables in wysiwyg style

  Sources   Download

MIT

The Requires

 

table content silverstripe

15/03 2018

2.0.0

2.0.0.0 https://github.com/nblum/

Allows to edit tables in wysiwyg style

  Sources   Download

MIT

The Requires

 

table content silverstripe

20/10 2016

0.1.1

0.1.1.0 http://www.blum-nico.de

Allows to edit tables in wysiwyg style

  Sources   Download

MIT

The Requires

 

table content silverstripe

14/10 2016

dev-ss4

dev-ss4 http://www.blum-nico.de

Allows to edit tables in wysiwyg style

  Sources   Download

MIT

The Requires

 

table content silverstripe

14/10 2016

v0.1.0

0.1.0.0 http://www.blum-nico.de

Allows to edit tables in wysiwyg style

  Sources   Download

MIT

The Requires

 

table content silverstripe