Download the PHP package nblum/silverstripe-table-field without Composer
On this page you can find all versions of the php package nblum/silverstripe-table-field. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download nblum/silverstripe-table-field
More information about nblum/silverstripe-table-field
Files in nblum/silverstripe-table-field
Download nblum/silverstripe-table-field
More information about nblum/silverstripe-table-field
Files in nblum/silverstripe-table-field
Vendor nblum
Package silverstripe-table-field
Short Description Allows to edit tables in wysiwyg style
License MIT
Homepage https://github.com/nblum/
Package silverstripe-table-field
Short Description Allows to edit tables in wysiwyg style
License MIT
Homepage https://github.com/nblum/
Please rate this library. Is it a good library?
Informations about the package silverstripe-table-field
silverstripe-table-field
Allows to edit tables in wysiwyg style. Saves the result in json.
Installation
Usage
In model
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
<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
Todos
- add config options for max rows and cols
All versions of silverstripe-table-field with dependencies
PHP Build Version
Package Version
Requires
silverstripe/framework Version
^4.0
The package nblum/silverstripe-table-field contains the following files
Loading the files please wait ....